Nick Harrison
Chris Massey

Overview of Routing

ASP.NET MVC Framework (Part 2): URL Routing [Blog]

Published in 2007. Scott Guthrie’s original announcement of the ASP.NET MVC framework. An explanation of the foundations of the routing architecture, plus some implementations. Bear in mind that this is from 2007, so it should only be read as an overview and introduction.

ASP.NET Routing [MSDN Library]

Unknown publishing date, but targets .NET 4. MSDN’s own overview of ASP.NET routing, as it applies to .NET Framework 4. This will give a very thorough coverage of routing. It balances depth against breadth consistently, and so it’s a good introduction to the concepts.

URL Patterns and Default Values

ASP.NET MVC Routing – Default Values [Blog]

Published in 2010.A focused, 100-level guide to default values. Simple examples and a quick read. This is part of the “ASP.NET 101” tutorials, maintained by SetFocus.

Defining Routes and URL Segments

How to Define Custom Route [StackOverflow]

Published in 2010.A StackOverflow solution to defining custom routes, specifically on using an existing UserController when performing various actions on a UserProfile. The solution is written in generic fashion, so it should be relatively easy to adapt.

Routing with Optional URL Segments [StackOverflow]

Published in 2009.A StackOverflow solution for how to generate a core (required) URL with additional optional segments, which have a default if no other segments are supplied. The solution is task-specific, so you’ll need to abstract it for a generic understanding.

Creating Custom Routes (C#) [ASP.NET]

Published in 2009.Official Microsoft article on creating custom routes in ASP.NET MVC, featured on ASP.NET. Bear in mind that this was written in 2009, so I’m not yet 100% sure how accurate this still is.

Prioritising Controllers

Routing – Prioritizing Controllers by Namespaces [Blog]

Published in 2012.An explanation of prioritization from an anonymous (yet apparently knowledgeable) web developer / release manager, in the context of a large application with controller names being duplicated across namespaces.

Ambiguous Controller Names in ASP.NET MVC [StackOverflow]

Published in 2011.A StackOverflow solution, discussing Phil Haack’s Areas demo, and controller name duplications across namespaces. This was originally last updated in 2010.

Constraining Routes

Creating a Route Constraint (C#) [ASP.NET]

Published in 2009.A tightly focused tutorial from the ASP.NET site. Steve Walther demonstrates how to create route constraints using regular expressions. Bear in mind that the tutorial is from 2009.

Constructing Outgoing URLS

Routing – Outgoing URLs [Blog]

Published in 2011.Another piece from the Bubblog series (see “Prioritizing Controllers”) – thorough coverage of how to construct outgoing URLs either manually, via Views (four variations), or via Action Methods (three variations).

Customising the Routing System

Custom Routing [Blog]

Published in 2008.Blog post by Ross Neilson, demonstrating how to create custom routes, and all the steps and configurations needed to get there. Written in 2008.

Custom Routes for MVC Application [The Code Project]

Published in 2011.A reasonably detailed Code Project article on how to customize your routing patterns, complete with downloadable source code. Written in December 2011.

Routing with Areas

Routing – Areas [Blog]

Published in 2012.Another (short) Bubblog post, covering areas as a concept, how to set one up, and how to set up basic routing configurations. Very simple – only worth reading if you’re completely new to areas.

Routing best practices

ASP.NET MVC Best Practices (Part 2) [Blog]

Published in 2009. Blog post by Kazi Manzur. Bear in mind that only the first section of the post is directly relevant, and the writing, though not perfect, is direct & easy to grasp.

KISS Your ASP.NET MVC Routes [Blog]

Published in 2010.A short post by Scott Allen about removing unnecessary complexity. Though posted in 2010, the principle is still relevant.

ASP.NET from Scratch: Routing in MVC [NetTuts]

Published in 2010.A .NET Tuts tutorial video, demonstrating a good overview of routing in ASP.NET MVC and, as well as finishing with some best practices, aiming to impart good understand and habits.

Optimizing ASP.NET MVC3 Routing [Blog]

Published in 2011.Sam Saffron (developer at Stack Overflow at the time of writing) has a deep-dive into how the Stack Overflow routes are optimized (targets ASP.NET MVC3).

Testing Routes

Testing Routing and URL Generation in ASP.NET MVC [Blog]

Published in 2010. Brad Wilson blogs about his method for testing Routing and URL generation, complete with all the necessary code. His method is compatible with both unit testing and interacting from outside the ASP.NET pipeline. Probably specifically targeted at ASP.NET MVC3.

Bypassing the Routing system

Using IgnoreRoute to Bypass the Routing System [Forums]

Published in 2011.A quick description of how to set up an exclusion to the routing system, posted on the Bing-Solution forums. Posted at the start of 2011, and describes IgnoreRoute.

Back to Basics: Dynamic Image Generation, ASP.NET Controllers, Routing, IHttpHandlers, and runAllManagedModulesForAllRequests [Blog]

Published in 2012.Scott Hanselman blogs about using HttpHandlers to bypass the managed Routing system, within the context managed modules and the whole pipeline of HTTP requests.

Leave a Reply

Your email address will not be published. Required fields are marked *