IIS7 and 301 permanent redirects using the location tag in web.config

Posted by Mike on Stack Overflow See other posts from Stack Overflow or by Mike
Published on 2010-03-30T16:10:54Z Indexed on 2010/03/30 16:53 UTC
Read the original article Hit count: 419

Filed under:
|
|

I need to setup some 301 permanent redirects in the web.config of an ASP.NET MVC application running under IIS.

The easiest way is to add a tag similar to the one below to the web.config file:

 <location path="TheMenu.aspx">
        <system.webServer>
            <httpRedirect enabled="true" destination="menus/" httpResponseStatus="Permanent" />
        </system.webServer>
    </location>

When I go to the site at http://domain.com/TheMenu.aspx it redirects me to http://domain.com/menusxd instead of http://domain.com/menus.

What would be causing this?

© Stack Overflow or respective owner

Related posts about iis7

Related posts about web-config