.NET 4

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

By Chris Pels|15 minutes|

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.

DOWNLOADS: Code (C#)|Code (VB)|MP3|MP4|WMV

This article was originally created on October 15, 2010

Author Information

Chris Pels

Chris Pels – Chris has been instrumental in the architecture, development, and implementation of a wide variety of business systems and databases as a technology consultant since 1986. He has extensive experience in business analysis, technical specifications, database design, several programming languages including C# and VB.NET, and statistical analysis. He holds a Ph.D. from The University of Michigan and has been a speaker at Microsoft TechEd, Microsoft DevDays, VSLive, numerous events in New England