Đang chuẩn bị liên kết để tải về tài liệu:
ASP.NET 4 Unleased - p 9

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

hông báo, hơn nữa, rằng Page_Load () xử lý sử dụng Trace.Warn () để viết tin nhắn vào phần Trace Thông tin. Bạn có thể sản xuất bất kỳ chuỗi ký tự vào phần Trace Thông tin mà bạn muốn. Trong Ví dụ 1.21, giá trị hiện tại của một biến có tên hiển thị truy cập. Bạn cần phải tận dụng lợi thế của trang truy tìm khi bạn muốn xác định chính xác những gì đang xảy ra khi một trang thực thi. Bạn có thể gọi Trace.Warn () phương thức bất cứ nơi nào bạn cần trong. | 54 CHAPTER 1 Overview of the ASf.NET Framework Notice furthermore that the Page_Load handler uses the Trace.Warn method to write messages to the Trace Information section. You can output any string to the Trace Information section that you want. In Listing 1.21 the current value of a variable named counter displays. You need to take advantage of page tracing when you want to determine exactly what is happening when a page executes. You can call the Trace.Warn method wherever you need in your code. Because the Trace Information section appears even when an error exists on your page you can use tracing to diagnose the causes of any page errors. One disadvantage of page tracing is that everyone in the world gets to see your trace information. You can get around this problem by taking advantage of application-level tracing. When application-level tracing is enabled trace information appears only when you request a special page named Trace.axd. To enable application-level tracing you need to add the web configuration file in Listing 1.22 to your application. LISTING 1.22 Web.Config xml version 1.0 configuration system.web trace enabled true system.web configuration After you add the Web.Config file in Listing 1.22 to your application you can request the Trace.axd page in your browser. The last 10 page requests made after application-level tracing is enabled display. WARNING By default the Trace.axd page cannot be requested from a remote machine. If you need to access the Trace.axd page remotely you need to add a localOnly false attribute to the trace element in the web configuration file. If you click the View Details link next to any of the listed page requests you can view all the trace messages outputted by the page. Messages written with the Trace.Warn method display by the Trace.axd page even when page-level tracing is disabled. From the Library of Wow eBook Installing ASPNET 55 NOTE You can use the new writeToDiagnosticsTrace attribute of the trace element to .

TÀI LIỆU LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.