How to read URL Content through VB.net code
By: Issac
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.
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
You have to write this code in the button click event so that if we click the Get Page button we will get the URL content.
Archived Comments
1. My developer is trying to persuade me tto move to .net
from PHP. I have always disliked the
View Tutorial By: Pole dance barcelona at 2017-07-01 17:21:00
2. This is the right webpage for anybody who hopes to understand this topic.
You realize a whole
View Tutorial By: ______ 403 at 2017-04-02 05:41:54
Comment on this tutorial
- Data Science
- Android
- AJAX
- ASP.net
- C
- C++
- C#
- Cocoa
- Cloud Computing
- HTML5
- Java
- Javascript
- JSF
- JSP
- J2ME
- Java Beans
- EJB
- JDBC
- Linux
- Mac OS X
- iPhone
- MySQL
- Office 365
- Perl
- PHP
- Python
- Ruby
- VB.net
- Hibernate
- Struts
- SAP
- Trends
- Tech Reviews
- WebServices
- XML
- Certification
- Interview
categories
Related Tutorials
Using Resume Next and Resume Line in VB.net
Using On Error GoTo 0 in VB.net
Getting an Exception's Number and Description in VB.net
Raising an Exception Intentionally in VB.net
Exception Filtering in the Catch Block in VB.net
Using Multiple Catch Statements in VB.net
Throwing an Exception in VB.net
Throwing a Custom Exception in VB.net
Changes in Controls from VB6 to VB.net
Unstructured Exception Handling in VB.net