How to view HTML source of any webpage using

This code will provide you HTML source of any webpage. You can parse it as per your requirement. GET method is used to retrieve information which is identified by the Request URI. I hope it will be useful for you all.

How to view HTML source of any webpage using
If you want to display any webpage of your intrasite page then proxy setting are not required.
If you want to display HTML source in the textbox then "Multiline" property has to be set as true.

Imports System.IO
Imports System.Net

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim strURL As String
Dim strResult As String
Dim myrequest As HttpWebRequest
Dim myresponse As HttpWebResponse
Dim sr As StreamReader
strURL = "your_intra_sitename"
myrequest = WebRequest.Create(strURL)
myrequest.Method = "GET"
Dim netCredential As New System.Net.NetworkCredential()
myrequest.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
myresponse = myrequest.GetResponse
sr = New StreamReader(myresponse.GetResponseStream)
strResult = sr.ReadToEnd
TextBox1.Text = strResult
End Sub
End Class


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: