ASP 101 - Active Server Pages 101 http.aspx
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<SCRIPT Language="VB" Option="Explicit" runat="server">
	Dim strHTMLLong As String
	Dim strHTMLShort As String
	Sub Page_Load(Src as object, E as EventArgs)
		strHTMLLong = GetWebPageAsStringLong("")
		strHTMLShort = GetWebPageAsStringShort("")
	End Sub
	' Before I start I should say that there are a number
	' of ways to do this (like anything), but this was the
	' one that made the most sense to me when I was writing
	' it.  If you think you've got a better way let me know
	' via email ->
	' In this version I Dim all my variables first in
	' a more traditional VB style.
	Function GetWebPageAsStringLong(strURI As String) As String
		Dim objURI As URI
		Dim objWebRequest As WebRequest
		Dim objWebResponse As WebResponse
		Dim objStream As Stream
		Dim objStreamReader As StreamReader
		Dim strHTML As String
		objURI = New URI(strURI)
		objWebRequest = WebRequest.Create(objURI)
		objWebResponse = objWebRequest.GetResponse()
		objStream = objWebResponse.GetResponseStream()
		objStreamReader = New StreamReader(objStream)
		strHTML = objStreamReader.ReadToEnd
		GetWebPageAsStringLong = strHTML
	End Function
	' In this version I Dim all my variables as I need
	' them and assign values to them on the same line.
	' It results in a much shorter set of code.
	' Even if it is wider ;)
	Function GetWebPageAsStringShort(strURI As String) As String
		Dim objURI As URI = New URI(strURI)
		Dim objWebRequest As WebRequest = WebRequest.Create(objURI)
		Dim objWebResponse As WebResponse = objWebRequest.GetResponse()
		Dim objStream As Stream = objWebResponse.GetResponseStream()
		Dim objStreamReader As StreamReader = New StreamReader(objStream)
		Dim strHTML As String = objStreamReader.ReadToEnd
		GetWebPageAsStringShort = strHTML
	End Function
<title>ASP.NET HTTP Request Sample from ASP 101</title>
<%= Server.HTMLEncode(strHTMLLong) %>
<%= Server.HTMLEncode(strHTMLShort) %>
<hr />
Click <a href="">here</a>
to read about and download the source code.