Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Community Wiki

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Navigation

Google Ads

ASP.NET: Simple debugging tips

From Wiki

Jump to: navigation, search


Summary: Simple debugging tips

Here are some simple debugging tips you can use when debugging your ASP.NET application in Visual Studio:


Contents [Hide]

Enabling debugging

To enable debugging you will need to add this line to your web.config file:

  1. <compilation debug="true" strict="false" explicit="true"/>


Setting a breakpoint

To start debugging you will need to set some breakpoints. If you want to find out what happens when a button is clicked, go to the Button Click event and click in the grey space to the left of the event. A breakpoint line will then be added to your page.


Start debugging

You can now start off the application by going to the Debug -> Start Debugging menu option. When you run through your application and click the button, the code will pause it's execution at the line you set the breakpoint on. Press F11 to step through your code one line at a time, or press F5 to just continue.


Getting Values

Whilst you are in debug mode there are a couple of methods you can use to find out the value of any variables you have set.

Method 1: Hover over an variable and the value will be shown in the popup window.

Method 2: Use the "Command Window" (View -> Other Windows-> Command Window). Simply enter the following:

  1. ? MyVariableName

to see the value of your variable.


This Hack is part of the ASP.NET Hacks collection

500 Rating: 3.9/5 (7 votes cast)