Tip of the day – redirecting in Asp.net

When you want to disable a specific site, there are several ways to do this. One is to remove the site completely or disable the site in IIS. But then the visitor of the site will get a 404 not found message. When you have a new site you want to redirect to, you can use this little snippet in your web.config to redirect to any url / site:
 
..
<location path="index.aspx">
    <system.webServer>
      <httpRedirect enabled="true" destination="http://www.other-site.com/" httpResponseStatus="Permanent" />
    </system.webServer>
</location>
..
 
Comments are closed