zoukankan      html  css  js  c++  java
  • 如何判断一个页面加载所耗费的时间【引用】

    C# code
    public class UrlReWrite : IHttpModule { private DateTime start; private DateTime end; public UrlReWrite() { // // TODO: 在此处添加构造函数逻辑 // } #region IHttpModule 成员 public void Dispose() { throw new Exception("The method or operation is not implemented."); } public void Init(HttpApplication context) { context.BeginRequest += new EventHandler(Begin_Request); context.EndRequest += new EventHandler(End_Request); } #endregion private void Begin_Request(object sender, EventArgs e) { start = DateTime.Now; //HttpApplication app = sender as HttpApplication; //string currentUrl = app.Context.Request.RawUrl; //string newUrl = Common.GeneratePhysical(currentUrl); //app.Context.RewritePath(newUrl); } private void End_Request(object sender, EventArgs e) { HttpApplication app = sender as HttpApplication; end = DateTime.Now; TimeSpan t = end - start; app.Context.Response.Write(string.Format("<!-- Server:{0} now:{1} exec time: {2}-->", app.Context.Server.MachineName,DateTime.Now, t)); }
  • 相关阅读:
    Dom页面加载
    Redis
    Ubuntu下git的安装与使用
    类Xadmin插件--海豚插件
    Python基础指随笔
    前端必须掌握30个CSS3选择器
    SweetAlert插件示例
    Pylint在项目中的使用
    django Cookie、Session和自定义分页
    django创建超级用户
  • 原文地址:https://www.cnblogs.com/hqbird/p/1424457.html
Copyright © 2011-2022 走看看