ASP.NET supports per-page tracing and application-level tracing. In both cases, ASP.NET displays the entire context of a request and response, including tracing statements. Visual Studio also supports debugging ASP.NET applications as though they were desktop applications. You simply set up breakpoints, fire up the debugger, and watch the fireworks. Debugging ASP.NET applications is very much like debugging desktop applications, thanks to Visual Studio.
Finally, ASP.NET takes over the custom error page handling process (which used to be managed by IIS in classic ASP). You may direct users to new pages depending upon the error that occurs. Finally, you can trap exceptions before they redirect and perform additional processing.
Tutorial 16 Quick Reference
How to prepare a Web site for debugging
Include the following in Web.Config:
<system.web> <compilation debug="true"/> </system.web>
How to enable tracing for an entire application
Include the following in Web.Config:
<system.web> <trace enabled="true"/> </system.web>
How to enable tracing for your page
Set the
Page
class'strace
attribute to true using either the property page in Visual Studio or by declaringtrace=true
in the page directive
How to debug a Web application in Visual Studio
Ensure that the debug attribute is turned on in Web.Config
Start the program running in debug mode by
Selecting
Debug | Start Debugging
from the main menuOR
2. Hitting the F5 key
How to set up breakpoints in an application in Visual Studio
Place the cursor on the line at which you'd like to stop execution and
Select
Debug | Toggle Breakpoint
OR
Hit the F9 key
How to execute a line of source code in the Visual Studio debugger
While the debugger is running and execution has stopped at the line you'd like to execute
1. Select
Debug | Stop Over
from the main menuOR
2. Hit the F10 key
How to step INTO a line of source code in the Visual Studio debugger
While the debugger is running and execution has stopped at the line you'd like to execute
How to instruct ASP.NET to show a specific page when an error occurs
Assign the error handling page to the specfic error in the
<customErrors>
section of Web.Config
How to trap specific errors in ASP.NET
Handle uncaught exceptions within the
Application_Error
handler in Global.ASAX. Usually, redirect to a specific page