How to Read PageContent by URL
Below function is used to get the page content by the URL
Import the name Spaces
Below function is used to get the page content by the URL
Import the name Spaces
using
System.Text;
using
System.Net;
public
string
readPageContent(string
sURL)
{
WebClient
objWebClient = new
WebClient();
System.Text.UTF8Encoding
objUTF8 = new
UTF8Encoding();
String
strRequestState;
Byte[]
PageHTMLBytes;
try
{
PageHTMLBytes = objWebClient.DownloadData(sURL);
return
strRequestState = objUTF8.GetString(PageHTMLBytes);
}
catch
(Exception
ex)
{
return
strRequestState = "No
page found...";
}
}
Comments
Post a Comment