1

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?

marr75
  • 5,666
  • 1
  • 27
  • 41
DarthVader
  • 52,984
  • 76
  • 209
  • 300
  • Wtheck? haha. Wrong usage of foo and bar imo? BTW Aspx is a type. – Younes May 07 '10 at 14:34
  • 1
    Younes, it's a legit question, he's looking for info on URL Rewriting. ASPX isn't necessarily a 'type', it's a file extension and many people would agree that it has no business in the end of a URL, but, for example, using IIS7's rewrite rules I could make it so that a page with *.aspx at the end is served by a .svc or .asmx or .asp file (why I would want to do so is beyond me). – marr75 May 07 '10 at 14:39
  • What version of ASP.NET are you using? – IrishChieftain May 07 '10 at 15:02

2 Answers2

2

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/

marr75
  • 5,666
  • 1
  • 27
  • 41
  • What @marr75 is (correctly) trying to say is that you need to configure this in IIS. It's got nothing (or maybe not much) to do with ASP.NET. – scherand May 07 '10 at 14:43
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/

Community
  • 1
  • 1
IrishChieftain
  • 15,108
  • 7
  • 50
  • 91