BT

Facilitating the spread of knowledge and innovation in professional software development

Contribute

Topics

Choose your language

InfoQ Homepage News FriendlyUrls – For ASP.NET WebForms

FriendlyUrls – For ASP.NET WebForms

This item in japanese

Bookmarks

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. 

Rate this Article

Adoption
Style

Hello stranger!

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

Get the most out of the InfoQ experience.

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

Community comments

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

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

BT