c# - I have imported the HttpWebRequest but visual studio is not recognizing the ContentLength properties -


using system.net.httpwebrequest; static string sendrequest(string method, string service, string postdata) {      string responsestring = null;     httpwebrequest request = (httpwebrequest)webrequest.create(service);      utf8encoding encoding = new utf8encoding();     byte[] data = encoding.getbytes(postdata);      request.method = "post";     request.contenttype = "application/x-www-form-urlencoded";     request.contentlength = data.length;       using (stream stream = request.getrequeststream())     {         stream.write(data, 0, data.length);     }      using (httpwebresponse response = (httpwebresponse)request.getresponse())     {         responsestring = new streamreader(response.getresponsestream()).readtoend();     }      return responsestring; } 

thew actual namespace system.net , in code should be

using system.net; 

httpwebrequest class name under namespace. if rather using system.net.httpwebrequest; in posted code; vs anyways throw red squiggly compilation error.


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

Python Error - TypeError: input expected at most 1 arguments, got 3 -

dns - How To Use Custom Nameserver On Free Cloudflare? -