If you’re using MVC and you’re looking for some in-depth information on basically whats going on when you run the code then you should take a look at Miniprofiler (from the guys at StackOverflow) or Glimpse.
Miniprofiler can be added in to your solution and can give you all sorts of really useful information such as which view is currently being rendered and from which method in the controller (which is not always obvious). this can be quite a time saver if you’re not used to the codebase and just want to quickly find the ActionResult which has been hit.
To Add MiniProfiler to an MVC application install it using the Nuget Package Manager console. (you need to use the console sometimes if the package uses a Powershell script)
Once added via Nuget browse to your global.asax file and add in the following 2 methods:-[sourcecode language=”csharp”] protected void Application_BeginRequest()
and then :-[sourcecode language=”csharp”] protected void Application_EndRequest()
Rebuild your code and run your application and you’ll see info being displayed by MiniProfiler in the top left hand corner as follows:-
After clicking on ‘Turn Glimpse On’ we see the little eyeball bottom right of the screen:-
When clicking on that you’ll see something like the following:-
Here we can drill into all sorts of information such as:-
- What route has been called
- Which view has been rendered
- Time spent to render the page and timings for each part
- Config on the server
Again go get them and you’ll have them up and running very quickly and benefit from the features they come with.