Login or Sign Up to become a member!

EXPERTS, INFORMATION, IDEAS & KNOWLEDGE

Social bookmarker Add this

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

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: 5.0/5 (2 votes cast)