views:

31

answers:

2

Consider a website that uses master pages and web user controls excessively.

(1)Master -> (2)page - > (3)web control > (4)web control -> (5)web control

this example of five levels may contain multiple web controls at each level.

Please don't bother commenting about the design of this scenario, it is outside my grasp (not capabilities, but authorities).

Either way I want to add a simple timer on each master/page/web-user-control, so that i can TIME in milliseconds the time it takes to load.

DateTime dbg = DateTime.Now;
//...
if (!String.IsNullOrEmpty(Request.QueryString["dbg"])) Response.Write("<b>partial className:</b> " + DateTime.Now.Subtract(dbg).TotalMilliseconds + "<hr />");

The site is way too massive to do manually. Is there a way i can do this centrally, just for debugging/profiling reasons?

-theo

+2  A: 

Maybe page trace is something you was looking for. In web config add:

<configuration>
  <system.web>
    <trace enabled="true" pageOutput="true" localOnly="false"/>
  </system.web>
</configuration>

More info on MSDN

Sergej Andrejev
+1  A: 

Also try profilers. My favorite are Red Gate's ANTS profiler and JetBrain's dotTrace

Sergej Andrejev
I installed dotTrace, but it won't open. just keeps loading.I will try the red-gate.
Theofanis Pantelides