url rewrite for aspx page

2019-05-30 00:26发布

问题:

I have a page, called foo.aspx and i d like to rewrite the url as bar.something

How to do this? How does url rewrite happens in asp.net

Should i create a generic handler?

or should i get some url rewrite modules and add to app?

回答1:

This is done by configuring IIS, and will require IIS7, look here for configuration help: http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/



回答2:

Remember, you also have the new Routing option with ASP.NET 4.0:

https://stackoverflow.com/questions/90112/iis-url-rewriting-vs-url-routing

You should also check this SO response:

IIS URL Rewriting vs URL Routing

Some basic info on the differences between URL Re-Writing and Routing:

http://learn.iis.net/page.aspx/496/iis-url-rewriting-and-aspnet-routing/