Screen Scrape of

This demo illustrates how to perform a screen scrape using the WebClient class. Note that only a few lines of code are needed. (With classic ASP, to perform screen scrapes you needed to use a third-party component.) To view the actual HTML returned by the screen scrape, do a View/Source.

Yahoo Yahoo

Source Code:
<%@ Import Namespace="System.Net" %>
<script language="VB" runat="server">
  Sub Page_Load(sender as Object, e as EventArgs)
    'STEP 1: Create a WebClient instance
    Dim objWebClient as New WebClient()

    'STEP 2 and 3
    Const strURL as String = ""
    Dim objUTF8 as New UTF8Encoding()
    lblHTMLOutput.Text = objUTF8.GetString(objWebClient.DownloadData(strURL))
  End Sub

  <h1>Screen Scrape of</h1>
  <asp:label id="lblHTMLOutput" runat="server" />

[Return to the Article]