module 5: using trace in microsoft asp.net pages

13
Module 5: Using Trace in Microsoft ASP.NET Pages

Upload: meredith-rodgers

Post on 19-Jan-2018

229 views

Category:

Documents


0 download

DESCRIPTION

Overview of Tracing With Tracing You Can: Output variables or structures Assert whether a condition is met Trace through the execution path of the application Can Be Enabled and Disabled, Either on a Page-By-Page Basis or for an Entire Application

TRANSCRIPT

Page 1: Module 5: Using Trace in Microsoft ASP.NET Pages

Module 5: Using Trace in Microsoft ASP.NET

Pages

Page 2: Module 5: Using Trace in Microsoft ASP.NET Pages

Overview

Overview of Tracing Trace Information Page-Level Trace Application-Level Trace

Page 3: Module 5: Using Trace in Microsoft ASP.NET Pages

Overview of Tracing

With Tracing You Can: Output variables or structures

Assert whether a condition is met

Trace through the execution path of the application

Can Be Enabled and Disabled, Either on a Page-By-Page Basis or for an Entire Application

Page 4: Module 5: Using Trace in Microsoft ASP.NET Pages

Trace Information

Page 5: Module 5: Using Trace in Microsoft ASP.NET Pages

Page-Level Trace

How Does Page-Level Trace Work? Demonstration: Adding Page-Level Trace Statements Tracing into a Component

Page 6: Module 5: Using Trace in Microsoft ASP.NET Pages

How Does Page-Level Trace Work?

Enabling Tracing for a Page

Sorting Output by Category

Inserting Trace Messages

Conditional Execution with Trace.IsEnabled

<%@ Page Language="VB" Trace="true"%>

<%@ Page Language="VB" Trace="true" TraceMode="SortByCategory"%>

Trace.Write("category", "message")

If Trace.IsEnabled strTrace = 'create trace string hereEnd IfTrace.Write(strTrace)

Page 7: Module 5: Using Trace in Microsoft ASP.NET Pages

Demonstration: Adding Page-Level Trace Statements

Page 8: Module 5: Using Trace in Microsoft ASP.NET Pages

Tracing into a Component

Import the System.Web Library

Enable Tracing in Class Constructor

Add Trace Statements to Method

Imports System.Web

HttpContext.Current.Trace.IsEnabled = True

HttpContext.Current.Trace.Write _ ("component", "this is my trace statement")

Page 9: Module 5: Using Trace in Microsoft ASP.NET Pages

Application-Level Trace

How Does Application-Level Trace Work? Demonstration: Adding Application-Level Trace

Statements

Page 10: Module 5: Using Trace in Microsoft ASP.NET Pages

How Does Application-Level Trace Work?

Application-Level Trace Collects Additional Statistics from a Request in the trace.axd File

Enabling Application-Level Trace in web.config

<trace enabled="true"traceMode="SortByCategory"

requestLimit="40" pageOutput="true"/>

Page 11: Module 5: Using Trace in Microsoft ASP.NET Pages

Demonstration: Adding Application-Level Trace Statements

Page 12: Module 5: Using Trace in Microsoft ASP.NET Pages

Lab 5: Adding Trace to an ASP.NET Page

Page 13: Module 5: Using Trace in Microsoft ASP.NET Pages

Review

Overview of Tracing Trace Information Page-Level Trace Application-Level Trace