How Do I: Use Routing with ASP.NET Web Forms?

by Chris Pels

In this video Chris Pels shows how to implement routing for Web Forms in ASP.NET 4. First, the concept of routing a URL is compared to mapping the URL to a physical file in the site. Then, a sample route for a URL is defined in the global.asax file Application_Start event handler. The route contains a parameterized value that the user can enter in the URL. A sample page is then created and the route parameter value is extracted in the Page_Load event handler. Next, a second route is defined that has multiple parameters and routes to the same page as the initial route. The Page_Load event handler is expanded to extract the additional route parameter value and display different information depending upon what values have been passed to the page.

▶ Watch video (15 minutes)