HttpWebRequest request = (HttpWebRequest)WebRequest.Create(APIURL);
string strData = null;
strData = "-------- data to assign---------";
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] data = encoding.GetBytes(strData);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
request.KeepAlive = true;
request.UserAgent = "Custom Agent";
request.ContentLength = data.Length;
request.AllowAutoRedirect = true;
request.Timeout = (int)new TimeSpan(0, 0, 60).TotalMilliseconds;
request.ServicePoint.Expect100Continue = false;
Stream newStream = request.GetRequestStream();
I getting above stated error at following line:
Stream newStream = request.GetRequestStream();