advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Download the code for this article
Have you explored HttpHandlers and HttpModules? Do you have a need for them? Did this article help you understand where they might be useful and how to use them? Let us know in the vb.dotnet.technical or csharp.general discussion groups.
Partners & Affiliates
advertisement
advertisement
advertisement
Average Rating: 3.7/5 | Rate this item | 19 users have rated this item.
 

Extending ASP.NET with HttpHandlers and HttpModules

Write custom file handlers and filters with ease in ASP.NET that perform special request-handling, or alter requests either before or after they're processed by the ASP.NET engine.  


advertisement
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 extension—for 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 request—thus hiding the real file names from the clients. Unlike HttpExtensions, HttpModules execute for every request—irrespective of the file extension. You can create an HttpModule to tweak the request either before or after the appropriate handler processes it.

  Next Page: The IHttpHandler and IHttpModule Interfaces


Page 1: ISAPI Extensions and FiltersPage 3: Creating an HttpHandler
Page 2: The IHttpHandler and IHttpModule InterfacesPage 4: Creating an HttpModule
Please rate this item (5=best)
 1  2  3  4  5
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs