WebClient发送POST请求

 
string postData = "client_id="+ Sina.APP_ID +"&client_secret="+ Sina.APP_KEY +"&grant_type=authorization_code&redirect_uri="+ Sina.RedirectUrl +"&code="+code;

            byte[] bytes = Encoding.UTF8.GetBytes(postData);

            WebClient client = new WebClient();
            client.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
            client.Headers.Add("ContentLength", postData.Length.ToString());
            byte[] responseData = client.UploadData("https://api.weibo.com/oauth2/access_token", "POST", bytes);

你可能感兴趣的:(ASP.NET)