CodeKicks.com
Focus on Microsoft Technologies - Tutorials, Articles, Code Samples.

Saturday, September 02, 2006

Screen Scrapes in ASP.NET

Introduction
One of the great things about ASP.NET is that many things that required a COM component in classic ASP are easily accomplished through a native ASP.NET Web page. This is because ASP.NET has access to the hundreds of .NET Framework classes, which are the same set of classes that all .NET-applications (from an ASP.NET Web page to a stand-alone Windows application) use. (ASP.NET is currently in Beta2 (as of July 6th 2001) and can be downloaded for free from http://www.ASP.NET.)

Some of the neat things that can be accomplished in an ASP.NET page, which in classic ASP required a component, include:

  • Performing screen scrapes
  • Sending email messages
  • Working with regular expressions
  • Creating dynamic GIF and JPG images
  • Working with the Web server's file system
  • Accessing the Windows Event Log and Performance Counters
  • ... the list goes on and on!

This article will focus on how to quickly and easily perform a screen scrape via an ASP.NET Web page using the System.Net.WebClient class.

Performing Screen Scrapes in Classic ASP
Before we delve into performing screen scrapes with ASP.NET, let's look at what was required to accomplish this with classic ASP. Since classic ASP cannot initiate an HTTP request, a COM component is required. There are a number of free COM components that can perform screen scrapes, such as ASPTear and AspHttp. Not surprisingly, there are a gaggle of articles on 4Guys explaining how to perform screen scrapes in classic ASP. If you are interested in learning more about this, be sure to check out the following articles: Grabbing Information from Other Servers, Grabbing Table Columns from Other Pages, and this FAQ.

Post a Comment