Creating Custom HttpHandlers

An HttpHandler is a class that has a single method that is invoked to handle a request. Rather than attaching itself to application events, an HttpHandler registers itself to listen for requests that match a specific path or wildcard expression. For example, you can create an HttpHandler that will respond to requests for all files ending in the .myHandler extension.

Another really good use for HttpHandlers is to create a handler that deals with .html files. Rather than have a single product.aspx page, you can have a virtual .html page for every product ID in your catalog. This allows a page to be bookmarked (and possibly spidered by search engines) and still be every bit as dynamic as a regular ASP.NET page.

Building ...

Get Microsoft® Visual C#® .NET 2003 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.