September 01, 2010

Implementing 301 redirects for the Dotnet (ASPX) sites

In my previous post I have explained to implement 301 redirect at IIS Level . Now let us walk through how to implement it for ASPX/ DNN sites.

Implementing 301 redirection for ASPX sites at the application level can be done by rewriting the URL.URL Rewriting can be done by configuring HTTP Modules in the hosting website.

There are 3 simple steps to be done to implement 301 redirect for the DNN/ ASPX sites which I have implemented for my current project, Thought of sharing it with all of you .

1. Import UrlRewritingNet.UrlRewriter.dll in DNN Site Bin Folder - This is open source component dll. It can be downloaded from the following path

2. We need to change web.config settings for defining URL ReWrite Section, URL ReWrite Settings and ReWrite the HTTP Module

The following need to be added in config sections of Web.config

<!--1st Add URLRewrite Section -->

<section name="urlrewritingnet" requirePermission ="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter" />

<!--2nd UrlRewritingNet.UrlRewrite entry -->




defaultPage = "default.aspx"


xmlns="" >


<add name="KickIt" virtualUrl="^http\://*).aspx"





ignoreCase="true" />



<!--3rd Add URL Rewrite HTTPModule entry under HTTP Modules section -->

<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />

No comments: