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.
Debugging refers to a process in the software development to find out bugs, errors in the program at
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.
<compilation debug="true" targetFramework="4.0" />
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
Get video tutorials of hundreds of ASP.NET Tips and Tricks like this here.
Namespace to use
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).
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 !