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.5. Respond to HTTP Requests from Your Application

Problem

You want your application to be able to respond to HTTP requests programmatically.

Solution

Use the System.Net.HttpListener class, which was first introduced in .NET Framework 2.0.

NOTE

Your application must be running on Windows XP Service Pack 2 (or later) or Windows 2003 (or later) to use the HttpListener class; otherwise, a System.PlatformNotSupportedException will be thrown when you try to instantiate it. Check the Boolean returned by the Shared property HttpListener.IsSupported to see whether support is available.

How It Works

The HttpListener class provides an easy-to-use mechanism through which your programs can accept and respond to HTTP requests. To use the HttpListener ...

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