Nishanth Reddy
Nishanth Reddy

Reputation: 609

How to implement extensionless URLs in ASP.NET Website

I have an ASP.NET website for which I have to implement extensionless URLS. Some examples that I need to achieve are:

mysite/home.aspx has to show up as mysite/home; and mysite/reports/checkout.aspx?ShowLogin=False has to show up as mysite/reports/checkout?ShowLogin=False

I have searched extensively on the web for an answer to this, tried implementing certain solutions, but I couldn't reach the goal. If anyone out there has implemented this, please help me through. Thanks.

Upvotes: 0

Views: 2944

Answers (1)

Vinayak Pahalwan
Vinayak Pahalwan

Reputation: 3005

Check out the following site:-

http://blogs.msdn.com/b/carlosag/archive/2008/09/02/iis7urlrewriteseo.aspx

basically the following code in the web.config file using the IIS7 URL Rewrite Module....this will solve ur prblm i guess

<rewrite>
        <rules>
            <rule name="RewriteASPX">
                <match url="(.*)" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                </conditions>
                <action type="Rewrite" url="{R:1}.aspx" />
            </rule>
        </rules>
    </rewrite>

Upvotes: 2

Related Questions