RouteDebugger 2.0

I’m at Mix11 all week and this past Monday, I attended the Open Source Fest where multiple tables were set up for open source project owners to show off their projects.

One of  my favorite projects is also a NuGet package named Glimpse Web Debugger. It adds a FireBug like experience for grabbing server-side diagnostics from an ASP.NET MVC application while looking at it in your browser. It provides a browser plug-in like experience without the plug-in.

One of the features of their plug-in is a route debugger inspired by my route debugger. Over time, as Glimpse catches on, I’ll probably be able to simply retire mine.

But in the meanwhile, inspired by their route debugger, I’ve updated my route debugger so that it acts like tracing and puts the debug information at the bottom of the page (click to enlarge).

About Us - Windows Internet Explorer

Note that this new feature requires that you’re running against .NET 4 and that you have the Microsoft.Web.Infrastructure assembly available (which you would in an ASP.NET MVC 3 application).

The RouteDebugger NuGet package includes the older version of RouteDebug.dll for those still running against .NET 3.5.

This takes advantage of a new feature included in the Microsoft.Web.Infrastructure assembly that allows you to register an HttpModule dynamically. That allows me to easily append this route debug information to the end of every request.

By the way, RouteDebugger is now part of the RouteMagic project if you want to see the source code.

What others have said

Requesting Gravatar... Nazar Gargol Apr 13, 2011 12:18 AM
# re: RouteDebugger 2.0
This is definitely better solution than playing with Application_Start :)
Requesting Gravatar... Carlos Apr 13, 2011 2:26 AM
# re: RouteDebugger 2.0
I just updated to RouteDebugger 2.0 and now EVERY page of my site (webforms) shows the Route Debugger section at the end. How can I disable it?
Requesting Gravatar... Carlos Apr 13, 2011 2:39 AM
# re: RouteDebugger 2.0
Not only this but also adds the route debug section to the response of my json handlers making them return invalid JSON. =(
Requesting Gravatar... Ivan Franjic Apr 13, 2011 5:18 AM
# re: RouteDebugger 2.0
Great tool, thanks for updating it :)

@Carlos you can 'disable' it by setting Copy Local property of RouteDebugger.dll to false.
Requesting Gravatar... Sasha Apr 15, 2011 1:04 AM
# re: RouteDebugger 2.0
do not understand how to use it :(
Requesting Gravatar... Fereshte Apr 15, 2011 4:06 PM
# re: RouteDebugger 2.0
Ive just installed it , now I want to disable it. how i can do it?
Requesting Gravatar... haacked Apr 16, 2011 2:43 AM
# re: RouteDebugger 2.0
I updated the RouteDebugger package. It now adds a Web.Config AppSetting. To disable it, set the setting to false.

<appSetting key="RouteDebugger:Enabled" value="false" />
Requesting Gravatar... ik Apr 17, 2011 5:32 PM
# RouteDebugger 2.0re:
ik
Requesting Gravatar... Jack Apr 18, 2011 4:41 AM
# re: RouteDebugger 2.0
I love this, now I can enable\disable route debugger on my local machine in one line!
Requesting Gravatar... Chris Sebok Apr 19, 2011 4:03 AM
# re: RouteDebugger 2.0
Brilliant little tool, just used it to sort out a n00b issue I was having, will keep it around...

However... it seemed to break my unobtrusive validation (using JQuery 1.5.1) - mainly my RemoteAttribute, though some of my RequiredAttribute model fields were breaking too... I disabled RouteDebugger and it all worked fine... just a heads up! Hit me up if you want some code examples :)
Requesting Gravatar... Eric Clark Apr 20, 2011 1:33 AM
# re: RouteDebugger 2.0
Great update, but I noticed that Nuget placed your license.txt at the top of my project, with no indication that it only covers RouteDebugger.dll. People could forget to remove the file and give users the impression their project is covered by your MS-PL license.
Requesting Gravatar... haacked Apr 20, 2011 11:31 AM
# re: RouteDebugger 2.0
@Eric, Ah! I should rename the license.txt file to be specific to my package. Thanks.
Requesting Gravatar... alexandros Apr 27, 2011 8:15 PM
# re: RouteDebugger 2.0
With the old debugger I could see a trace in cases when my routes weren't working at all (an exception was thrown due to bad routes). is there a way to achieve this now?
Requesting Gravatar... Shane Whittet Apr 28, 2011 2:37 AM
# re: RouteDebugger 2.0
Recommend investigating best place for License.txt file, as we don't necessarily want that file deployed.

Regards!
Requesting Gravatar... Marc Simkin May 04, 2011 5:14 AM
# re: RouteDebugger 2.0
With IIS 7.x, .Net 4, and MVC 3, if the application pool is set for classic mode, the HttpModule dynamic registration doesn't work.

Any suggestions on how to get it to work in classic mode?

thanks
Requesting Gravatar... Marc Simkin May 04, 2011 9:37 PM
# re: RouteDebugger 2.0
Got it to work in classic mode. It seems that the issue is not routing but a 404/Page not Found. Shouldn't the routing info be displayed even with a page not found?
Requesting Gravatar... Jonas Stawski May 05, 2011 6:23 AM
# re: RouteDebugger 2.0
Awesome debugger, saved me a headache trying to figure out why the right action was not executing. Just FYI that jQuery breaks if using the route debugger. It is kind of annoying hitting the conitnue (or ignore) button in VS for every JS error. Other than that, great work, like usual...
Requesting Gravatar... Hardy Wang May 31, 2011 11:53 PM
# re: RouteDebugger 2.0
Just not working. I installed from NuGet, added Microsoft.Web.Infrastructure.dll reference in my MVC3/.Net 4 project.

After I launched my application, nothing about routing information showed up.
Requesting Gravatar... Troy Jun 20, 2011 1:46 PM
# re: RouteDebugger 2.0
So how would I go about using RouteDebugger to debug Redirect Routes configured with RouteMagic?

Currently the output shows n/a for all Redirect routes.
Requesting Gravatar... Neil Knight Jul 07, 2011 10:15 PM
# re: RouteDebugger 2.0
I have the same problem as Carlos. I have disabled the RouteDebugger in the web.config file, but all of my Javascript files break because it is inserting the CSS for the RouteDebugger. Any ideas on how to fix this? I've tried to remove the RouteDebugger and all references to it, but I still get the CSS in the Javascript files.
Requesting Gravatar... Tyson Benson Jul 19, 2011 10:07 AM
# re: RouteDebugger 2.0
@Niel Knight: I found the same problem, my Javascript and CSS would have the route debugger html appended to the end of the response. I eventually found out it was the browser's cache persisting the route debugger as part of the response even after I disabled the route debugger, so I cleared my cache and everything was fine.
Requesting Gravatar... joj Aug 23, 2011 11:20 AM
# re: RouteDebugger 2.0
I wanted the debugger mainly for debugging routes that don't work (meaning, error results: 404 or "I couldn't find the view, and I searched everywhere" type results). Routes that work are of little interest to me. The old debugger did this. The new one doesn't, or I have to configure stuff I don't know how to configure. I have gone back to the old debugger because of this.
Requesting Gravatar... Matt Nov 02, 2011 7:31 AM
# re: RouteDebugger 2.0
I don't think that catch all is working.. I'm a n00b to MVC but I need this to work for routes that do not match... having a lot of trouble with that for some reason..

Any thoughts?
Requesting Gravatar... Chadrick Jan 24, 2012 4:55 PM
# re: RouteDebugger 2.0
I've used this before the old Global.asax way. I've installed 2.1.2.0 using Nuget. No window is appended at the end of the page. I have the config app setting set to true. I noticed that I did not have Microsoft.Web.Infrastructure added to my MVC project refs and added that but it makes no diff. I'm debugging my app using ASP.NET Dev Server. Does this make a diff?
Requesting Gravatar... Jakka Jan 25, 2012 7:45 AM
# re: RouteDebugger 2.0
I also had the same problem as above. Installed Route Debugger 2.1.2 using NuGet, compile, and run the project using ASP.NET Dev Server... but no window is appended at the end of the page. And yes, I've the RouteDebugger:Enabled settings in the web.config set to true.

I ended up using the github version and found out that all my requests to DebugHttpHandler is not processed because of the following line:


if (!IsRoutedRequest(request) || !request.ContentType.Equals("text/html", StringComparison.OrdinalIgnoreCase))


Somehow my current Request.ContentType always returns an empty string which is not equal to text/html :(
Requesting Gravatar... Chadrick Jan 25, 2012 9:17 PM
# re: RouteDebugger 2.0
Also grabbed the RouteMagic solution from github, ran the RouteDebuggerDemoWeb project and nothing shows there either. Strange things...
Requesting Gravatar... Cluggas Jan 26, 2012 11:01 AM
# re: RouteDebugger 2.0
I'm getting the same problem. NuGet package installed and enabled, but no route information appearing.

@Jakka Request.ContentType is an empty string for GET requests, as far as understand it. Is this why your requests satisfy this condition?
Requesting Gravatar... Cluggas Jan 26, 2012 1:05 PM
# re: RouteDebugger 2.0
That check for Request.ContextType is the cause of my problem. Setting it manually at the start of each request causes everything to work as expected.

I totally see why the check is there - you would only want the route information attached to the page itself and not any other content - but should it not be a check on the response instead of the request? I can't be sure if that makes sense in the context of the code posted b @Jakka, but it would seem to make sense.
Requesting Gravatar... haacked Jan 26, 2012 6:08 PM
# re: RouteDebugger 2.0
@Cluggas would you mind logging an issue in the GitHub repository?

It's a better place to discuss it. I'll look into it and we can hash out what the proper solution should be there. Would love your help in thinking it through. :)
Requesting Gravatar... Erik Apr 13, 2012 8:24 AM
# re: RouteDebugger 2.0
I've installed the RouteDebugger, but can't see any route debugging? The web.config option is enabled <add key="RouteDebugger:Enabled" value="true" /> why?

No errors, just the site as before installing RouteDebugger?
Requesting Gravatar... Won May 14, 2012 9:54 PM
# re: RouteDebugger 2.0
Works just fine. Thank you

RouteDebugger via Nuget Version 2.1.3.0
IIS 7.5
.NET 4
MVC3
Web.config transformation

What do you have to say?

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