ASP.NET HTTP module for URL redirections
For my own web sites, I needed to perform multiple URL rewritings, both in order to get short URLs and to charm Google and friends. You can see this at work for the SharpToolbox for example.
I improved Fritz Onion's HTTP Module, which performs redirects based on entries in your web.config file. It is regular expression-based, and is an easy way to perform automatic redirection for one set of URLs to another in your site.
I improved performance by keeping Regex instances, and added support for the ~ character.
Here is what the config file can look like:
<redirections type="Madgeek.Web.ConfigRedirections, Madgeek.RedirectModule">
I joined a small demo to the source code. Download.
Update: 2004/11/19 - added support for ignoring case. See the ignoreCase attribute.
Update: 2005/05/12 - works with .NET 2.0, you just have to replace the calls to ConfigurationSettings.GetConfig() by calls to the new ConfigurationManager.GetSection()