Theofanis Pantelides
Theofanis Pantelides

Reputation: 4864

Profiling ASP.NET website and controls

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

Upvotes: 0

Views: 147

Answers (2)

Sergej Andrejev
Sergej Andrejev

Reputation: 9413

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

Upvotes: 1

Sergej Andrejev
Sergej Andrejev

Reputation: 9413

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

Upvotes: 2

Related Questions