Mobile app version of vmapp.org
Login or Join
Murray155

: How do you hide file extension in URL? 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

@Murray155

Posted in: #AspNet #Url

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Murray155

1 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme