Get ASPX page execution time full solution

xiaoxiao2021-03-06  73

In the development process, you often want to improve performance. In Web development, the page execution time is a very important performance parameter. BOSS often complains that a page is very slow, although it has made a lot of optimization, access is slowly probably the network problem However, there must be a quantified data of persuasive, and the aspx can't get execution time as ASP. Is there any good way to wait until the ASPX page execution time? After a period of exploration, I finally found a full solution: 1. Add a class in the project, it is called the pageelapse.cs code as follows (the sample code of the Microsoft PM & A2K lecture): use system; using system.Web Download Adobe Reader: USING SYSTEM

Namespace Common {///

/// pageelapse's summary description. /// public class pageelapse: httpmodule {private datetime _starttime

Public void init (system.web.httpApplication context) {context.beginRequest = new eventhandler (OnBeginRequest); context.endrequest = new eventhandler

Public void dispose () {}

Private void OnbeginRequest (Object Sender, Eventargs E) {_StartTime = DateTime.now;

Private void OneundRequest (Object Sender, Eventargs E) {Timespan Ts = DateTime.now - _StartTime;

HttpContext.current.response.write ("

Here, use the data island output, in fact, there will be "

"The page will only be displayed

转载请注明原文地址:https://www.9cbs.com/read-93799.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.046, SQL: 9