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.

Ronnie Diaz Avatar

Published by

One response to “Simple URL ReWriting/Mapping in IIS7”

Leave a comment