11.5. Respond to HTTP Requests from Your Application


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


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


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 ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.