Screen Scrape of www.yahoo.com

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!
My Yahoo!
My Mail
Why miss out?
To see all the new Yahoo! home page has to offer, please upgrade to a more recent browser.

Supported browsers include:
Internet Explorer 7 optimized by Yahoo!
Firefox 3
Safari 3
Opera 9
Flock
Answers
Autos
Entertainment
Finance
Games
Geocities
Groups
Health
Horoscopes
HotJobs
Kids
Local
Maps
Messenger
Movies
Music
News
Personals
Real Estate
Shopping
Sports
Tech
Travel
TV
Weather
Yellow Pages
Y! International
All Yahoo! Services
Advertise with us | Search Marketing | Privacy Policy | Terms of Service | Suggest a site | Yahoo! en Español | Send Feedback | Help

Copyright © 2008 Yahoo! Inc. All rights reserved. Copyright/IP Policy | Company Info | Participate in Research | Jobs


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 = "http://www.yahoo.com/"
    Dim objUTF8 as New UTF8Encoding()
    lblHTMLOutput.Text = objUTF8.GetString(objWebClient.DownloadData(strURL))
  End Sub
</script>

<html>
<body>
  <h1>Screen Scrape of www.yahoo.com</h1>
  <p>
  <asp:label id="lblHTMLOutput" runat="server" />
</body>
</html> 
  


[Return to the Article]