Article posted by
Sheonarayan on 6/27/2011 | Views: 4958 | Category:
ASP.NET | Level: Intermediate |
Points: 250
If you found
plagiarised (copied) or inappropriate content,
please
let us know the original source along with your correct email id (to communicate) for further action.
Bug is unavoidable in application at the time of development. Debugging helps us to find out bugs and error in the program. In this article, we shall learn how to enable debugging in an ASP.NET application.
Introduction
Debugging refers to a process in the software development to find out bugs, errors in the program at development stage.
In order to demonstrate, how to enable debugging in an asp.net application I am going to show important code changes needs to be done in asp.net application.
WEB.CONFIG < system.web >
< compilation debug = " true " targetFramework = " 4.0 " />
</ system.web >
By default web.config has compilation debug=false that restricts the application to run into the debug mode. Changing it to true allows the application to write the debug statements in the Output window. These statements can be anything that helps the developer to know what exactly is going on while executing the program in the development stage.
To use the Debug class, we need to use System.Diagnostics namespace.
Watch the video of this topic below
VIDEO Get video tutorials of hundreds of ASP.NET Tips and Tricks like this here .
Code Behind
Namespace to use
using System.Diagnostics ;
protected void Page_Load( object sender, EventArgs e)
{
Debug.WriteLine( "START - Page_Load executing" );
txtSample.Text = "Some data" ;
Debug.WriteLine( "END - Page_Load executing" );
}
The Debug statement can be seen in the Output window (Debug > Windows > Output).
OUTPUT
Notice the last two statements in the above window that is being written because of Debug.WriteLine statements in the Page_Load event.
Hope this article was useful, thanks for reading and keep reading & sharing !
If you like this article, subscribe to our RSS Feed . You can also subscribe via email to our Interview Questions, Codes and Forums section.
Found interesting? Add this to: