Skip to Content
Beginning ASP.NET MVC 1.0
book

Beginning ASP.NET MVC 1.0

by Simone Chiaretta, Keyvan Nayyeri
August 2009
Beginner to intermediate content levelBeginner to intermediate
575 pages
13h 16m
English
Wrox
Content preview from Beginning ASP.NET MVC 1.0

Chapter 7. Routing

Now that you have completed your journey exploring the three parts of an MVC application, it's time for you to learn about the places where a request meets the application: the routing engine.

In this chapter, you learn:

  • What routing is

  • How to define routing rules

  • How to debug routes

Life before Routing

In a typical WebForm-based Web application, the user types a URL in the address bar of his browser, and then the request is sent to the server. The server takes the URL, looks at the file system for a file that is located in the folder and with the name specified in the URL, executes the code-behind that is mapped to the file, and finally sends the response back to the user. To display the listing of all the books in the category ASP.NET, you would type http://example.com/catalog/booklisting.aspx?id=345. But this URL is not a very good one. For the user it's not obvious that 345 is the ID of the category of books on ASP.NET.

Speaking of search engine optimization (SEO), because all categories are retrieved using the same path (catalog/booklisting.aspx), search engines might not do a very good job of indexing the bookstore catalog. A URL like http://example.com/catalog/ASPNET would have been both more SEO-friendly and easier to remember and understand for the end user, who could just change the last part to ASPNETMVC to get all the books on ASP.NET MVC.

Over the years, many solutions have been implemented to make WebForm URLs more user- and SEO-friendly, the most notable ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning ASP.NET MVC 4

Beginning ASP.NET MVC 4

José Rolando Guay Paz
Programming ASP.NET MVC 4

Programming ASP.NET MVC 4

Jess Chadwick, Todd Snyder, Hrusikesh Panda
Professional ASP.NET MVC 2

Professional ASP.NET MVC 2

Jon Galloway, Phil Haack, Scott Hanselman, Scott Guthrie, Rob Conery

Publisher Resources

ISBN: 9780470433997Purchase book