Learning Curve…

What is the feature that is supported by ASP.NET 4.0 for user friendly and meaningful URLs?

Posted on: April 16, 2012

 

ASP.NET 4.0 supports built in support for URL Routing. This can make site more user friendly and site content more discoverable by search engines. It is also easy to remember and while bookmarking.

Following example shows URL without using Routing mechanism of ASP.NET 4.0.

http://website/products.aspx?categoryid=12

After using Routing mechanism of ASP.NET 4.0, above URL becomes as follow.

http://website/products/software

For mapping above URL to the list of products based on category, we need to map our route using new method MapPageRoute of class Route as shown in following examples.
Application_Start(object sender, EventArgs e)   {
     RouteTable.Routes.MapPageRoute(“ProductsRoute”,
         “product/{prodId}”, “~/products.aspx”);
}

 

Advertisements

1 Response to "What is the feature that is supported by ASP.NET 4.0 for user friendly and meaningful URLs?"

You are an angel for me. I have wasted my whole night in this problem. m newbie :(… thx for the help… Bookmarking it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Author

Learning days (Calendar)

April 2012
M T W T F S S
« Mar   Jun »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Knowledge Bank (Archives)

I am on Twitter

Blog Stats

  • 507,854 hits

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 43 other followers

%d bloggers like this: