P. 1
ASP Net

ASP Net

5.0

|Views: 2,821|Likes:
Published by Abdulraheman

More info:

Published by: Abdulraheman on Jun 04, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

12/16/2012

pdf

text

original

246

ASP.NET

HANDLE ERRORS PROGRAMMATICALLY

133617-6 Ch12.F 9/26/01 9:45 AM Page 246

Á Create an error on the
page by changing the SQL
statement to an invalid SQL
statement.

‡ Save the page and request
it from the Web server.

I You remain on the same
page and an error message
appears.

Because you are on the same page in which the error occurred,you
can print out a number of details about the error.

Example:

247

DEBUG YOUR ASP.NET APPLICATIONS 12

133617-6 Ch12.F 9/26/01 9:45 AM Page 247

⁄ Open

DatagridTemplate.aspx

from the Code Templates
directory.

¤ Turn on tracing for
the page by setting the
Trace="true" attribute
for the @Page directive.

‹ Save the page and request
it from the Web server.

I The page contents appear.

› Scroll down the page
until you get to the Request
Details.

You can use page tracing on your individual

ASP.NET pages to get information about the
page request when attempting to debug your
site.Tracing can be set on the page level with the
@Pagedirective.To trace an ASP.NET Web page,you
need to add <%@ PageTrace="true" %>to the
top of the page.When the page is requested,the
trace information appears.

With traces you can inspect the common collection of
the HttpRequestand execution flow (timing and
call stack).The Trace Information section displays the
different functions and their associated execution
times.The Control Tree section shows detailed
information about the use of controls and control

hierarchy for the page.The Cookies Collection
section displays all the cookies sent in the request.
The Headers Collection section shows the name value
pairs sent in the header section of the request.The
Server Variablessection displays information about
the server,including security and configuration
information.

The trace information for a page appears at the
bottom of the page.You can add your own trace
information to page level traces.The trace
information is available to you through the
TraceContextobject.This object can be
accessedby using the Traceproperty of a Page
orthrough the HttpContext.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->