Introducing RouteMagic

Over the past couple of years, I’ve written several blog posts on ASP.NET Routing where I provided various extensions to routing. Typically such blog posts included a zip download of the binaries and source code to allow readers to easily try out the code.

But that’s always been a real pain and most people don’t bother. But now, there’s a better way to share such code. Moving forward, I’ll be using NuGet packages as a means of sharing my code samples.

In the case of my routing extensions, I’ve compiled them into a solution I call RouteMagic (source is available on GitHub). This solution includes two packages, RouteMagic.Mvc (extensions specific to ASP.NET MVC Routing) and RouteMagic (more general ASP.NET Routing extensions). The RouteMagic.Mvc package depends on the RouteMagic package.

These packages are available in the NuGet feed!

After installing the RouteMagic.Mvc package, you’ll have the following  features available to you.

The source code for the solution contains the following projects:

  • RouteMagic
  • RouteMagic.Mvc
  • RouteMagic.Demo.Web (ASP.NET MVC Web application used to demo these features)
  • UnitTests

This is just a pet project I put together based on various blog posts I’ve written. I’d love to see some of these ideas eventually make it into the Framework. But until then, you’ll probably see these things make it into Subtext for sure!

What others have said

Requesting Gravatar... Nick Berardi Jan 30, 2011 4:59 AM
# re: Introducing RouteMagic
Wow I really like the delegate handler and the groups.

Do you mind if I use these concepts with my Apache mod_rewrite style overlay for setting up ASP.NET routes?

github.com/.../RoutingApacheRuleSet.cs

The delegates would be a great way to allow plugin routes. And the grouping is very easy already, so it would be a natural extension.
Requesting Gravatar... Bats Ihor Jan 30, 2011 5:25 AM
# re: Introducing RouteMagic
Another one great thing in the NuGet feed! Thank you.
Requesting Gravatar... haacked Jan 30, 2011 5:57 AM
# re: Introducing RouteMagic
@Nick, feel free. I licensed the code under a very liberal Ms-PL license. :)
Requesting Gravatar... A-Dubb Jan 31, 2011 9:20 AM
# re: Introducing RouteMagic
Thanks for the extensions. Will check them out. Keep up the good work MVC team.
Requesting Gravatar... Daniel Feb 04, 2011 11:35 PM
# re: Introducing RouteMagic
Thanks for making it public :) i might try it.
Requesting Gravatar... Doug Clutter May 04, 2011 1:00 AM
# re: Introducing RouteMagic
Any reason this wouldn't work with the Azure SDK? Also tried Glimpse and it didn't work either.
Requesting Gravatar... Thomas Tai Aug 11, 2011 4:49 PM
# re: Introducing RouteMagic
Hi Phil, thanks for the library.
However it only works on the ASP.NET Development Server. Once I deployed it to IIS7 on my production Windows Server 08 R2 box, routing function just doesn't work any more. What's going on?
I have already added the follow to my web.config but still doesn't work.
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
Requesting Gravatar... What Sep 02, 2011 12:14 AM
# re: Introducing RouteMagic
So you remove the ability to download the source code. How can we get to the demo that you say exist? You have no example of how to execute routemagic so that we can see the trace. So, all we can do is simply download the assembly without any idea of how to use it. Most of us need to debug our routes and will not need handler and grouping which is the only example. Your site says there is an example but since only the assembly is available we dont have access to the demo. Consider making the souce available again.
Requesting Gravatar... haacked Sep 02, 2011 2:05 AM
# re: Introducing RouteMagic
@What, the source is available. http://routemagic.codeplex.com/
Requesting Gravatar... Andrea Dec 11, 2011 11:42 PM
# re: Introducing RouteMagic
Hello.

How can I use RouteDebugger to get infos about a 404 error page?

It looks like my routing map is not properly configured, but I can't find where is the issue.

Can Route Debugger intercept a 404 error and shows some data?
Requesting Gravatar... haacked Dec 12, 2011 2:14 PM
# re: Introducing RouteMagic
@Andrea, yeah, RouteMagic should intercept every request, unless IIS handles it first.
Requesting Gravatar... Andrea Mar 06, 2012 8:13 PM
# re: Introducing RouteMagic
Well, I'm still facing issues with this.

I just want to debug 404 errors, but installing this NuGet package simply doesn't do the trick.

The old RouteDebugger also doesn't work when I get a 404 error page (it does work with matching routes).

What do you have to say?

(will show your gravatar)
Please add 1 and 6 and type the answer here: