private void BrowseUrl(string url)
{
try
{
HttpWebRequest loHttp = (HttpWebRequest)WebRequest.Create(url);
// *** Return the Response data
HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();
Encoding enc = Encoding.GetEncoding(1252); // Windows-1252 or iso-
if (loWebResponse.ContentEncoding.Length > 0)
{
enc = Encoding.GetEncoding(loWebResponse.ContentEncoding);
}
StreamReader loResponseStream =
new StreamReader(loWebResponse.GetResponseStream(), enc);
string response = loResponseStream.ReadToEnd();
if (response.Length != 0)
{
// You can write this response to some textbox here also
}
loResponseStream.Close();
loWebResponse.Close();
}
catch (Exception ex)
{
throw ex;
}
}
No comments:
Post a Comment