read content of an HTML page
 

When we want to read content of an HTML page from a remote webserver , in vb.net we are using WebRequest , WebResponse . WebResponse return a StreamReader and we can get the content from StreamReader .


VB.NET SourceCode

Imports System.Net
Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim inStream As StreamReader
Dim webRequest As WebRequest
Dim webresponse As WebResponse
webRequest = webRequest.Create(TextBox1.Text)
webresponse = webRequest.GetResponse()
inStream = New StreamReader(webresponse.GetResponseStream())
TextBox2.Text = inStream.ReadToEnd()
End Sub
End Class


(c) Shilpa Sayura Foundation 2006-2017