I was slightly wrong, last time I used this was with ASP.MVC. But I've managed to get a working example for you to try:
Global.ASAX
private bool isStarted;
protected void Application_Start(object sender, EventArgs e)
{
this.isStarted = false;
}
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (!isStarted)
{
this.isStarted = true;
if (Request.IsLocal)
{
MiniProfiler.Start();
}
}
}
protected void Application_EndRequest(object sender, EventArgs e)
{
MiniProfiler.Stop();
}
Page.aspx
protected void Page_Load(object sender, EventArgs e)
{
var miniprofiler = MiniProfiler.Current;
var htmlString = miniprofiler.Render();
Literal1.Text = htmlString.ToString();
}
It's going to need some tweaking but at least it'll give you something to work with. I'm not entirely convinced that mini-profiler is designed to work with ASP.Net web forms though.
Oh and Literal1
is just a standard Literal control.