Blog Stats
  • Posts - 35
  • Articles - 0
  • Comments - 3
  • Trackbacks - 2

 

Read Response of a web request in a byte Array with C# Asp.net

this code snippet read the respone fo a web request through binary reader
 
private byte[] getByte(string URL)
{
HttpWebRequest wrGETURL = (HttpWebRequest)WebRequest.Create(URL);
System.Net.HttpWebResponse webresponse = (HttpWebResponse)wrGETURL.GetResponse();
string ct = webresponse.ContentType;
Stream objStream = webresponse.GetResponseStream();
BinaryReader breader = new BinaryReader(objStream);
byte[] buffer = breader .ReadBytes((int)webresponse.ContentLength);
return buffer;
}

Feedback

No comments posted yet.


Post a comment





 

 

 

Copyright © Sharvan Dhaka