且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在asp.net中获得响应时间。

更新时间:2023-09-10 10:27:40

get(' container')。style.cursor = ' wait';


find(' mdlPopupPleasewait')。节目();
}



i做了一些rnd我发现了这个

  protected   void  Application_BeginRequest( object  sender,EventArgs e)
{
Context.Items.Add( Request_Start_Time,DateTime.Now);
}
受保护 void Application_End( object sender,EventArgs e)
{
TimeSpan tsDuration = DateTime.Now.Subtract((DateTime)Context.Items [& quot; Request_Start_Time& quot;]);
Context.Response.Write(& quot;& lt; b& gt;请求处理时间:来自Global.asax文件& quot; + tsDuration.ToString());

}


我对你到底在做什么感到困惑,但我会做出一些假设。 br />


如果您使用UpdatePanel来执行AJAX回发,则可以使用UpdateProgress控件在指定的时间(例如,2秒)后显示某些内容。 br />


假设您有一个名为 upSearch 的UpdatePanel,您的UpdateProgress控件将如下所示:

 <   asp:UpdateProgress     runat   = 服务器    AssociatedUpdatePanelID   =   upSearch    DisplayAfter   =  2000 >  
< ProgressTemplate >
< div class = search_progress >
正在更新...
< / div >
&lt ; / ProgressTemplate >
< / asp:UpdateProgress &GT; 跨度>


hi,i want when a user click on the button,linkbutton or tabcontainer a loading image should be display,but if the response time is less than 2 sec for a gridview to get fully loaded & displayed,that time i dont want the loading image should be display .
i am showing the loading image through javascript,as

function onBeginRequest() 
{      
        $get('container').style.cursor = 'wait';
        $find('mdlPopupPleasewait').show();
}


i did some rnd and i found this

protected void Application_BeginRequest(object sender, EventArgs e)
        {
            Context.Items.Add("Request_Start_Time", DateTime.Now);
        }
protected void Application_End(object sender, EventArgs e)
      {
          TimeSpan tsDuration = DateTime.Now.Subtract((DateTime)Context.Items[&quot;Request_Start_Time&quot;]);
          Context.Response.Write(&quot;&lt;b&gt;Request Processing Time: From Global.asax file &quot; + tsDuration.ToString());

      }

get('container').style.cursor = 'wait';


find('mdlPopupPleasewait').show(); }


i did some rnd and i found this

protected void Application_BeginRequest(object sender, EventArgs e)
        {
            Context.Items.Add("Request_Start_Time", DateTime.Now);
        }
protected void Application_End(object sender, EventArgs e)
      {
          TimeSpan tsDuration = DateTime.Now.Subtract((DateTime)Context.Items[&quot;Request_Start_Time&quot;]);
          Context.Response.Write(&quot;&lt;b&gt;Request Processing Time: From Global.asax file &quot; + tsDuration.ToString());

      }


I''m a little confused about what exactly you are doing, but I''ll make some assumptions.

If you are using an UpdatePanel to do your AJAX postbacks, you can use an UpdateProgress control to show something after a specified number of time (e.g., 2 seconds).

Supposing you have an UpdatePanel called upSearch, your UpdateProgress control would look something like this:
<asp:UpdateProgress runat="server" AssociatedUpdatePanelID="upSearch" DisplayAfter="2000">
  <ProgressTemplate>
    <div class="search_progress">
      Updating...
    </div>
  </ProgressTemplate>
</asp:UpdateProgress>