简体   繁体   English

如何在asp.net的aspx页面中显示请求处理时间?

[英]How to display request process time in aspx page in asp.net?

How to display request process time in aspx page in asp.net ? 如何在asp.net的 aspx页面中显示请求处理时间?

I have been tried by http module begin request and end request difference time span in response.write method, but after display request process time in aspx page my web application was hanged. http模块在response.write方法中尝试了开始请求和结束请求的时间差,但是在aspx页面中显示请求处理时间后,我的Web应用程序被挂起。 Screen other functionality was hanged not working. 屏幕其他功能被挂起无法正常工作。

can any one please tell me how can we display request process time in asp.net web application i tried .net 3.5 / IIS 7.5 integrated mode 有谁能告诉我如何在我尝试过.net 3.5 / IIS 7.5集成模式的asp.net Web应用程序中显示请求处理时间

Your question is really difficult to understand - in terms of what your trying to fully achieve. 关于您要完全实现的目标,您的问题确实很难理解。

I tried to break it down, and am assuming you just want to know how to calculate how long a process took to run. 我试图将其分解,并假设您只是想知道如何计算一个进程运行了多长时间。

If that's the case, then this will work - we get the Now.Ticks are the start and also at the end and then convert them into seconds. 如果是这种情况,那么它将起作用-我们得到Now.Ticks是开始,也是结束,然后将其转换为秒。

In VB 在VB中

    Dim tStart As Long = Now.Ticks
    '' Do processing
    Dim tEnd As Long = Now.Ticks
    Dim tTaken As String = "Time taken " + TimeSpan.FromTicks(tEnd - tStart).TotalSeconds.ToString()

And in C# 在C#中

    long tStart = Now.Ticks;
    // Do processing
    long tEnd = Now.Ticks;
    string tTaken = "Time taken " + TimeSpan.FromTicks(tEnd - tStart).TotalSeconds.ToString();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM