ASP.NET provides a robust framework for your Web applications. However, at times it becomes necessary to go beyond the out-of-the-box functionality.
For example, when you request a resource such as an HTML page or ASP page using the browser, IIS processes that resource based on its file extension. IIS processes ASP pages using a DLL named asp.dll. Similarly, IIS processes ASP.NET (.aspx
) pages with the aspnet_isapi.dll
. But sometimes you may need to process custom file extensions. Suppose you're developing a Web application that makes frequent use of graphics generated on-the-fly that display charts. You might want those files to use a custom file extensionfor example .chart
ISAPI Extensions and Filters
Before ASP.NET, the only way to process custom file extensions was to write an ISAPI (Internet Service Application Programming Interface) extension or an ISAPI filter. However, writing ISAPI extensions and filters is difficult, requires strong C/C++ skills, and is considered "out of reach" for many programmers. ASP.NET improves the situation greatly. ASP.NET's HttpExtensions and HttpModules provide functionality similar to ISAPI Extensions and ISAPI filters, respectively. Writing HttpHandlers and HttpModules is just a matter of implementing certain interfaces.
HttpExtensions let you process a particular extension (or a set of extensions) using custom code.
Similarly, HttpModules let you filter client requests. For example, you could use an HttpModule if you wanted to manipulate the requested URL by changing the file names before letting the ASP.NET engine handle the requestthus hiding the real file names from the clients. Unlike HttpExtensions, HttpModules execute for every requestirrespective of the file extension. You can create an HttpModule to tweak the request either before or after the appropriate handler processes it.