Get the code for the page execution time

xiaoxiao2021-03-06  58

Get the code of the page execution time in the global.asax.cs file

protected

Void

Application_BeginRequest (Object Sender, Eventargs E)

{Application ["StartTime"] = system.datetime.now;}

protected

Void

Application_ENDREQUEST (Object Sender, Eventargs E)

{System.DateTime startTime = (System.DateTime) Application [ "StartTime"]; System.DateTime endTime = System.DateTime.Now; System.TimeSpan ts = endTime - startTime; Response.Write ( "Execution Time:" ts .Milliseconds "milliseconds");}

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

New Post(0)