Client code writing method: Add the initial time in the Head section of the page
Add
Insert a tag with the ID TimeShow where it needs to be displayed
Server code writing:
protected DateTime dt;
protected void Page_Load(object sender, EventArgs e)
{
}
protected override void OnPreInit(EventArgs e)
{
dt = DateTime.Now;
base.OnPreInit(e);
}
protected override void OnLoadComplete(EventArgs e)
{
base.OnLoadComplete(e);
TimeSpan ts = DateTime.Now - dt;
Response.Write("Time to load page:" ts.TotalMilliseconds);
}