| Sometimes we may need to get the HTML contents of a web page programmatically
and without loading it in a browser. The following code can be used for doing
it. LetÂ’s take a look..
Private Function ReturnWebData(ByVal URL As String) As String
Dim WebResltStr As String = Nothing
Dim DtStrm As Stream = Nothing
Dim StrmRdr As StreamReader = Nothing
Dim WebReqst As WebRequest = Nothing
Dim WebResp As HttpWebResponse = Nothing
Try
'Create the web request
WebReqst = WebRequest.Create(URL)
WebReqst.Credentials = CredentialCache.DefaultCredentials
'Get the response
WebResp = DirectCast(WebReqst.GetResponse(), HttpWebResponse)
<http://www.mindfiresolutions.com/Retrieve-the-resulting-HTML-data-from-a-webpage-493.php> | |