ASP.NET的Trace

來源:互聯網
上載者:User

Author:zfive5(zhaozidong)
Email: zfive5@yahoo.com.cn

    下午翻《ASPX.NET進階編程》後又一點寫的衝動,這麼好的功能應該讓更多的人知道。在.aspx檔案裡加入<%@Page Trace="True" %>,然後在執行aspx檔案,你會看到原介面下多了一些資訊,請求詳細資料、跟蹤資訊 、控制項樹 、Cookie 集合、標題集合 和伺服器變數.

aspx代碼:

private void Page_Load(object sender, System.EventArgs e)
{
   // 在此處放置使用者代碼以初始化頁面
   Trace.Write("Trace1");
   Trace.Warn("Warn1");
   Trace.Write("Trace2");
}

  
執行後trace跟蹤資訊部分如下:

類別        訊息 From                         First(s)              From Last(s)
aspx.page  Begin Init  
aspx.page  End Init                            0.001612               0.001612
           Trace1                                   0.002763               0.001150

           Warn1                                   0.003155               0.000393

           Trace2                                   0.003240               0.000085

aspx.page  Begin PreRender               0.003287               0.000047
aspx.page  End PreRender                  0.003331               0.000044
aspx.page  Begin SaveViewState         0.003636               0.000305
aspx.page  End SaveViewState            0.004491               0.000856
aspx.page  Begin Render                     0.004559               0.000068
aspx.page  End Render                        0.051202               0.046643

不錯,連執行時間都輸出來了。

    看看trace輸出的Cookie資訊後,再看會話 session ID,數值是一樣的,看來的確asp.net的session是用Cookie實現的!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.