views:

36

answers:

1

While developing my ASP.NET MVC, I have started to see the need for a debugging console window to assist in figuring out what is going right and wrong in my code. I read the last few chapters of the Pro Asp.net MVC book, and the author details how to use http modules to show page load/creation times and linq to sql query logs, both of which I definitely want to be able to see. However, since I am loading a lot of small sections of my page individually with ajax I don't want the debug information right there in the middle of my screen.

So the idea I came up with was to have a separate browser window (open-able by a link or some javascript) with a console log, that can contain logged entries both from javascript and from the asp.net mvc run. The former should be relatively easy, but I'm having trouble coming up with a way to log the asp.net information in ajax requests.

The direction I have been thinking of going is to create an httpmodule (like the Pro MVC book does), and have that module contain some script tags that append the javascript's log to console calls with the messages. The issue I see with this is finding a way to get the log messages from the controller's action methods to the httpmodule's methods. The only way I see to do this is with a singleton, but I'm not sure if singletons are bad practice for a stateless web application.

Furthermore, it seems like if I return json with my ajax calls (instead of pure html) then that won't work at all unless there is a way to add data to an existing json structure inside the httpmodule.

How does everyone else handle this type of debugging in heavily ajax applications?

For reference, the javascript library I am using is jquery.

+2  A: 

Why not Firebug or Fiddler? (or both? Together they do 99% of what you need.)

Dave Swersky
I don't see how I'm going to get information about how long it takes to generate the page (page generation and time for the ajax request to get back to me are totally separate), information about the queries that were run by linq to sql, and other asp.net mvc run information from those tools that I need to do performance optimization and backend data verification. For instance, if I'm expecting 3 values to be sent but only 2, with those tools there's no way for me to determine if it's an html generation issue, database query issue, etc.. without completely rerunning in debug mode in VS.
KallDrexx
Sounds like you're looking more for profiling- Red Gate's ANTS is a good example for that.
Dave Swersky