tags:

views:

244

answers:

5

What's the best way to implement friendly URL in ASP.net?

+3  A: 

Like this: http://stackoverflow.com/questions/223750/how-do-net-sites-hide-aspx-extension-of-their-files

(In other words, your question is a duplicate.)

BoltBait
+1  A: 

The ASP.NET Routing Framework provided in .NET 3.5 SP1 is a good one.

Although it is very new, it can handles many URL-related tasks and most frequently used URL-friendly schemes very well.

It can be used outside of MVC, too.

chakrit
A: 

The best way to do this is to look into the new MVC toolkit from microsoft (http://www.asp.net/mvc/)

See http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx for an example.

Sure, its only beta right now, but the core of it is the routing system that makes it possible to make intelligent urls based on actual content.

I.e. to edit product with id 5 you'd have an url that looked like /Product/Edit/5

If I read the specifications correctly, you can use this routing system for anything (i.e. so you don't have to recode the entire site to use it), and it can default to allow direct references to an existing file to have precedence over its own rules (i.e. /myfile.aspx will still use the file, instead of a route). That way you can mix and match the technologies and urls while you make the trancendance to the new routing based system.

Soraz
A: 

I have used UrlRewriter.Net library. It is small but powerful and easy to configure.

Marko Dumic
A: 

If you're looking to do this in earlier versions of the .Net Framework, you can use the RemapURL tool from the IIS 6.0 Resource Kit. We use it, and all it takes is installing the dll, creating a very simple ini file with your friendly urls and their associated endpoints, and enabling the dll in Web Service Extensions Very simple how-to here.

cori