Q: How do I calculate the total time it takes to render an MVC page and display the time on the master page.
In Asp.net Web Form I created a Base page class like so:
public class PageBase : System.Web.UI.Page
{
private DateTime startTime = DateTime.Now;
private TimeSpan renderTime;
public DateTime StartTime
{
set { startTime = value; }
get { return startTime; }
}
public virtual string PageRenderTime
{
get
{
renderTime = DateTime.Now - startTime;
return renderTime.Seconds + "." + renderTime.Milliseconds + " seconds";
}
}
}
I would then call the method on my Master Page like so:
<div id="performance">
<% =PageRenderTime %>
</div>
Q: How do I accomplish the same thing with the MVC Framework?
Q: With the MVC framework where do I set the start time when a page is first created?