BT

FriendlyUrls – For ASP.NET WebForms

by Roopesh Shenoy on Sep 11, 2012 |

FriendlyUrls is a new ASP.NET feature that allows developers to easily use pretty urls in their web forms applications. It also makes it easier to manage both Mobile and Desktop views in the same project, similar to MVC. Scott Hanselman explains more.

How do you use this package? Just add the nuget package to the project, call routes.EnableFriendlyUrls() and your /Foo.aspx will be available at the /Foo route! You can also use Url segments to pass more information to the page (/Foo/bar/34) and then retrieve it using Request.GetFriendlyUrlSegments() method for use in the Foo.aspx page. 

Some more exciting features Scott shows -

  • Automatic switching to mobile-specific views if the request comes from a mobile device
  • Ability to customize behaviour by extending the WebFormsFriendlyResolver class – for e.g. to add device-specific handling

Scott emphasizes how this is just one more step in the grand One ASP.NET plan that is getting evolved over time. We have already noted how the productivity gap between Web Forms and MVC is getting reduced with the .NET 4.5 release.

Note that FriendlyUrls is still in alpha, mainly out to elicit more feedback from developers. It does however work with both .NET 4.5 and .NET 4.0, so you can use it with your existing .NET 4 applications as well. 

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT