I would like to drop the .aspx extension from my webpages. One reason is that I'm not sure I will stick to ASP.NET WebForms technology. How do you do it?

2 Answers 2


Inbound URLs are easy - simply grab a tool like URL Rewriter, create a rule to map incoming requests that do not have .aspx to include the aspx in the processing of the request and you are done.

The problem, however, is outbound URLs. Your site/app generates URLs everywhere and every one of those contains a link to something.aspx and which is the very format you are trying to get away from. You can either rewrite your entire app to not include the .aspx or you can put something in the pipeline to filter those out of the pages before they are sent to the user.

Again, URL Rewriter can do this, but it takes a while to get the rules right. Another fairly common approach is to simply write your own httpModule and do the processing yourself.

Bear in mind that any utility that rewrites outbound page content may cause problems with server-side caching.


you can achieve by modifying your web.config file using URL rewriting.

            <rule name="RemoveASPX" enabled="true" stopProcessing="true">
                <match url="(.*)\.aspx" />
                <action type="Redirect" url="{R:1}" />
            <rule name="AddASPX" enabled="true">
                <match url=".*" negate="false" />
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    <add input="{URL}" pattern="(.*)\.(.*)" negate="true" />
                <action type="Rewrite" url="{R:0}.aspx" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.