How can I use miniprofiler in asp.net web site(NOT FOR MVC)?
There are many resources for MVC but I can not find anything for web site.
Thanks to Alex. Now it works for asp.net web site. But I can not understand what it displays.
I have not written any code in method. See the image below.
Code is as below for which I ran profiler.
protected void Page_Load(object sender, EventArgs e)
{
using (MiniProfiler.Current.Step("test"))
{
Page.Title = "12345";
}
}
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
From the miniprofiler.com:
PM> Install-Package MiniProfiler
in your global.asax:
using StackExchange.Profiling;
...
protected void Application_BeginRequest()
{
if (Request.IsLocal)
{
MiniProfiler.Start();
}
}
protected void Application_EndRequest()
{
MiniProfiler.Stop();
}
and then somewhere in your master page:
<%= StackExchange.Profiling.MiniProfiler.RenderIncludes() %>
This should be enough for starting.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0