asp.net - How do I display the duration it took to generate a page in a pages footer? -
During debug, I want to show the time taken to create pages for pages in the footer, server side.
For example, if a page takes 250 mms server side then I would like to be displayed in the footer, in debug builds. How can I get it into the ASP.NET MVC project?
Add it to the footer in your master page:
< Code> Page Rendering took & lt;% = DateTime.Now.Subtract (this.ViewContext.HttpContext.Timestamp) Total EmyliseCand Toastring ()%>You can also wrap it in an extension method:
public stable class extension {public static string RequestDurationinMs (This HtmlHelper Assistant) {#If Return Date DateTime.Now.Subtract (Assistant .ViewContext.HttpContext.Timestamp) TotalMilliseconds.ToString (); #endif}}
Use this as:
& lt;% = Html.RequestDurationinMs ()%>
You may need to import the namespace of the extension class:
& lt;% @ import namespace = "your namespace"% & gt;
Comments
Post a Comment