O'Reilly logo

Visual Basic 2008 Recipes: A Problem-Solution Approach by Rakesh Rajan, Matthew MacDonald, Allen Jones, Todd Herman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

11.6. Get an HTML Page from a Site That Requires Authentication

Problem

You need to retrieve a file from a web site, but the web site requires that you provide credentials for the purpose of authentication.

Solution

Use the System.Net.WebRequest and System.Net.WebResponse classes as described in recipe 11-4. Before making the request, configure the WebRequest.Credentials and WebRequest.Certificates properties with the necessary authentication information.

You could also use the System.Net.WebClient class (discussed in recipe 11-3). It also has Credentials and Certificates properties that allow you to associate user credentials with a web request. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required