Simple URL ReWriting/Mapping in IIS7
There’s an easy alternative to other over-complicated solutions on the web if your mappings are simple/static and/or you have a spare grunt to quickly and easily keep them updated without having to write a line of code.
In web.config add:
<system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer>
Under system.web add static mappings like so:
<urlMappings enabled="true"> <add url="~/default" mappedUrl="index.aspx"/> <add url="~/login" mappedUrl="login.aspx"/> <add url="~/logout" mappedUrl="logout.aspx"/> </urlMappings>
Voila.
Of course some scenarios require more complex mappings, but for most non-ecomm/non-web app sites and even blogs this solution would work np, be faster to maintain without requiring assembly publishes and is less error-prone.
Posted on April 6, 2011, in Programming & Development and tagged .net, iis7, rewriting, url mapping. Bookmark the permalink. 1 Comment.
Pingback: URL Rewriting on GoDaddy and Shared hosting « Fraction of the Blogosphere