2310 b 06

522 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
522
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
26
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

2310 b 06

  1. 1. Module 6:Tracing in Microsoft ASP.NET Web Applications
  2. 2. Overview  Understanding Tracing  Remote Debugging
  3. 3. Understanding Tracing  Runtime Information  Enabling Tracing  Using the Trace Object  Viewing Trace Results  Using Application-Level Trace  Demonstration: Tracing Through a Web Application  Tracing into a Component
  4. 4. Runtime Information  During runtime, you can:  Output values of variables  Assert whether a condition is met  Trace through the execution path of the application  You can collect runtime information using:  The Trace object  The Debug object
  5. 5. Enabling Tracing  Page-level tracing displays trace statements only on the configured page  Enabling page-level tracing <%@ Page Language="vb" Trace="true" %> <%@ Page Language="c#" Trace="true" %>  Application-level tracing displays trace information for all pages in a Web application  Enabling application-level tracing in the Web.config file <trace enabled="true" pageOutput="true" localOnly="true"/>  Practice: Check default settings
  6. 6. Using the Trace Object  Inserting trace messages Trace.Write ("category", "message") Trace.Warn ("category", "message")  Conditional execution with Trace.IsEnabled If Trace.IsEnabled Then strMsg = "Tracing is enabled!" Trace.Write("myTrace", strMsg) End If if (Trace.IsEnabled) { strMsg = "Tracing is enabled!"; Trace.Write("myTrace", strMsg); }  Dynamically change state of trace Trace.IsEnabled = False
  7. 7. Viewing Trace Results
  8. 8. Using Application-Level Trace Page Application Result Trace=True or Trace=True  Trace results are displayed on page Trace=False Trace=True or Trace=False  Trace results are not displayed Trace=False Trace not set Trace=True  Trace results are displayed on page  Application-level trace statements are displayed on individual pages  Set pageOutput=false in the Web.config file and trace results are viewable by trace viewer http://server/project/trace.axd
  9. 9. Demonstration: Tracing Through a Web Application  Page-level tracing  Application-level tracing
  10. 10. Tracing into a Component  Import the System.Web Library Imports System.Web using System.Web;  Enable Tracing HttpContext.Current.Trace.IsEnabled = True HttpContext.Current.Trace.IsEnabled = true;  Call Trace methods HttpContext.Current.Trace.Write _ ("component", "this is my trace statement") HttpContext.Current.Trace.Write ("component", "this is my trace statement");
  11. 11. Lesson: Remote Debugging  How to Perform Remote Debugging
  12. 12. How to Perform Remote Debugging  Remote debugging:  Debug Web applications remotely  Simplifies team development  Simplifies Web site management  Requirements for remote debugging:  Requires Visual Studio .NET or remote components on the server  Visual Studio .NET must be installed on the client  Requires administrative access to the server  Requires access for the user who is performing debugging
  13. 13. Review  Understanding Tracing  Remote Debugging
  14. 14. Lab 6: Tracing in Microsoft ASP.NET Web Applications Logon Page Login.aspx BenefitsCoho Home Page Page Header ASPStateWinery Default.aspx Header.ascx Menu Registration Component Register.aspx Class1.vb or Class1.cs Web. tempdb config Life Insurance Retirement Medical Dental Life.aspx Retirement.aspx Medical.aspx Dental.aspx Prospectus Doctors User Control XML Web Lab Web Prospectus.aspx Doctors.aspx namedate.ascx Service Application dentalService1.asmx XML Doctors Dentists Files

×