在Glogal.asax页面中增加以下代码
DateTime dt; protected void Application_BeginRequest(Object sender, EventArgs E) { dt = DateTime.Now; } protected void Application_EndRequest(Object sender, EventArgs E) { DateTime dt2 = DateTime.Now; TimeSpan ts = dt2 - dt; Response.Write("The request takes " + ts.TotalMilliseconds.ToString() + " milliseconds"); }