What you want to see on DotNetFunda.com ?
Go to DotNetFunda.com
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 24775 |  Welcome, Guest!   Register  Login
Home > Articles > ASP.NET > How to enable debugging in an ASP.NET Application?

How to enable debugging in an ASP.NET Application?

Article posted by Sheonarayan on 6/27/2011 | Views: 4958 | Category: ASP.NET | Level: Intermediate | Points: 250 red flag


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

 
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.

Page copy protected against web site content infringement by Copyscape
Found interesting? Add this to:



Please Sign In to vote for this post.

About Sheo Narayan

Experience:8 year(s)
Home page:http://www.snarayan.com
Member since:Tuesday, July 08, 2008
Level:HonoraryPlatinum
Status: [Microsoft_MVP] [Administrator]
Biography:Microsoft MVP, Author, Writer, Mentor & architecting applications since year 2001.

Connect me on Facebook | Twitter | LinkedIn | Blog

 Responses
Posted by: Tripati_tutu | Posted on: 29 Jun 2011 01:34:18 AM | Points: 25

Nice one sir ...

Posted by: Lakn2 | Posted on: 29 Jun 2011 05:20:26 AM | Points: 25

good one

Posted by: Akiii | Posted on: 03 Jul 2011 09:31:17 AM | Points: 25

nice article sir....

Regards
Akiii

>> Write Response - Respond to this post and get points
Related Posts

We are In many sites to save HINDI data in SQL data base. But is too difficult to insert HINDI font in data base. I am tried to solve this problem. Then he work exactly .

By using this Article you can learn how to change BackGround Color of a Row in Gridview when user moves mouse on a particular selecting Row.

This article will help you in getting a brief overlook about the commonly used Alt + Shortcut keys

This article shows how to log error using asp.net in either a log file or in System event log.

This is related to ASP.NET 4.0, where now there is no need to type runat attribute.

More ...
About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/24/2013 3:13:09 AM