ASPAlliance.com : The #1 Active Server Pages .NET Community The #1 ASP.NET Community
Search   Search

Subscribe   Subscribe

Powered by ORCSWeb Hosting


Site Stats


Powered By ASP.NET
 
Featured Sponsor

Featured Columnist


Featured Book
ASP.NET Unleashed
ASP.NET Unleashed

Find Prices
Read Review
Sample Chapter
Sample Chapter
Sample Chapter
Sample Chapter


New! asp.netPRO

We publish our articles in the standard RSS format.

Powerful .NET Email Component

Code Sharing Software
WebClient.aspx.vb by Damian Manifold
  1 public class Webclient4
  2     Inherits System.Web.UI.Page
  3     protected WithEvents Literal1 as System.Web.UI.WebControls.Literal
  4 
  5     private Sub Page_Load(ByVal sender as System.objectByVal e as System.EventArgs) Handles MyBase.Load
  6         Dim wc as new System.Net.WebClient()
  7         Dim s as System.IO.Stream
  8         Dim sr as System.IO.StreamReader
  9 
  10         'set the header information
  11         wc.Headers.Add("Accept", "*/*")
  12         wc.Headers.Add("Accept-Encoding", "gzip,deflate")
  13         wc.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)")
  14         wc.Headers.Add("value", "this is a test")
  15 
  16         'scrape the data
  17         s = wc.OpenRead("http://authors.aspalliance.com/damianm/article/4/4/headreader.aspx")
  18 
  19         'read in the page
  20         sr = new System.IO.StreamReader(s)
  21         Literal1.Text = sr.ReadToEnd()
  22     End Sub
  23 
  24 End class
WebClient.aspx.vbGenerated using CodeView
 Copyright © 2000-2003 ASPAlliance.com  Page Rendered at 11/21/2009 6:49:59 PM