When we make a HttpWebRequest using method POST, we must specify the length of data sending.
string data = "Test data to be sent";
byte[] postData = Encoding.ASCII.GetBytes(data);
webRequest.ContentLength = postData.Length;
If we wish not to send any data, just set it to 0..
webRequest.ContentLength = 0;
Note: If we are not sending any data, we should use the GET method.
No comments:
Post a Comment