Interested in description of your most used ASP.NET httpmodules that solved a specific problem for your webapp.
Best practices and in-the-field usages are welcome.
views:
798answers:
8ELMAH is very popular and useful for exception logging in ASP.NET applications.
Used a module which checks for Authorization of a given user. So, when any resource is requested it checks whether the user has the rights to access it, and if not it would take the user to a friendly page.
ACL can be in Authz DB or an xml file and are differentiated using the roles.
An HttpModule that supports friendly URLs by converting human-legible URLs into the ones the program uses behind the scenes on every requst. It also drives my CMS.
For me the most used http module is the the forms authentication module.
We use it to secure pretty much every website we use.
MBCompression: handlers and modules to compress Css files, JavaScript files, pages and WebResource.axd.
I use it in environments where I don't have full control of the server and native IIS compression is not possible.
Run a background service when you don't have access to the server's OS (as is the case in a shared hosting environment).
I've got an SSL module which checks if the page being requested needs to be accessed via SSL, and redirects accordingly. The list of pages or folders which must be accessed via an SSL connection are stored in an XML file. When pages being are requested via SSL which don't need to be, the module redirects them to the non-SSL version, and vice-versa.
I use a suite of http modules and http handlers:
http://code.google.com/p/talifun-web/
StaticFileHandler
An http handler that will serve static files in a cached, compressed and resumable manner.
It generates consistent etags and the correct meta tags for caching on proxies and locally. This is especially useful when you don't have control over the configuration of the webserver.
It can also serve cached requests and compressed cached requests from memory bypassing the hard drive.
It supports the following http header tags:
- Accept-Ranges
- ETag
- Expires
- Last-Modified
- Range
- If-Range
- If-Match
- If-None-Match
- If-Modified-Since
- If-Unmodified-Since
- Unless-Modified-Since
CrusherModule
A module that compresses js into a single file, and css into a single file.
It also watches for changes to any of the watched css or js files and regenerates the crushed file. It generates a unique hash for the crushed file and appends it to the css url and the js url. So you are always sure to be served the correct content, regardless of caching.
CssSpriteModule
A module that combines component images into a single sprite image file and generates the css sprite file required to cut the sprite image into its component images.
RegexUrlAuthorizationModule
A module that provides authorization based on urls matching regular expressions.
LogUrlModule
A very simple module that makes it easy to hook into web requests that match a regular expression.
PageCompressionModule
A module to compresses dynamic pages for webforms and mvc.