ASP.Net 2.0 urlMappings (Web.config)

Following up to my previous post, the urlMappings section in Web.config allows one to configure rudimentary url rewriting.

For example, putting this into your section:


add url="~/PageThatDoesNotExist.aspx" mappedUrl="~/RealPage.aspx" />

will result in RealPage.aspx being rendered while the browser still thinks it reached PageThatDoesNotExist.aspx. One thing to note is that the URL must be application root relative. This was actually of interest to me since I wanted to do something similar but with a permanent redirect. It looks like in order to be able to do that, they had to bake urlMappings support pretty deep into the framework (way deeper than an HttpModule). Too bad.

If you know of a way to get ResolveUrl functionality in an HttpModule, please let me know!