Sunday, January 8, 2012

Creating an Http Handler in ASP

Creating an Http Handler

It’s possible to create a type that implements the IHttpHandlerinterface and have it respond
to any pattern of URL. The advantage is you have full control over the URL, and the URL of the
request doesn’t need to correspond to a physical file. The downside is that IIS configuration is
required to map the URL into the framework, and ASP.NET configuration is required to map
the URL to your specific handler.
The alternative is to use the built-in, simple handler factory. This handler is mapped to
files with an ASHX extension. The WebHandlerdirective is used to point an ASHX page at a type
that implements the IHttpHandlerinterface. Visual Studio adds a file with this directive to
your project via the Generic Handler option in the Add New Item dialog window.

No comments:

Post a Comment