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.
Why not Firebug or Fiddler? (or both? Together they do 99% of what you need.)
精彩评论