Chapter 8. URLs and Routing

Before ASP.NET MVC, the core assumption of routing in ASP.NET (just like in many other web application platforms) was that URLs correspond directly to files on the server's hard disk. The server executes and serves the page or file corresponding to the incoming URL. Table 8-1 gives an example.

Table 8-1. How URLs Have Traditionally Corresponded to Files on Disk

Incoming URL

Might Correspond To

http://mysite.com/default.aspx

e:\webroot\default.aspx

http://mysite.com/admin/login.aspx

e:\webroot\admin\login.aspx

http://mysite.com/articles/AnnualReview

File not found! Send error 404.

This strictly enforced correspondence is easy to understand, but it's also very limiting. Why should my project's file names and directory structure ...

Get Pro ASP.NET MVC 2 Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.