This tutorial is the first part of the ASP.NET Web Site Debugging tutorial series. This tutorial will demonstrate how to enable debugging with an ASP.NET 4.0 Web Site in Microsoft Visual Studio 2010.

When working with ASP.NET Web Sites, debugging is not enabled by default. However, with more complex projects you may want to debug your ASP.NET Web Site.

Creating a Web Site

The first thing we want to do here to demonstrate debugging is create a new ASP.NET Empty Web Site. Once created, we want to add a Web Form to it. To do this:

  1. Right click the project in your Solution Explorer.
  2. Select Add New Item..
  3. Choose a Web Form.
  4. Name it Default.aspx.
  5. Click Add.

Now that we have a Web Form, I want to demonstrate how to view this page without debugging. To do this, right click on Default.aspx in your Solution Explorer and select View in Browser. This will load up your website without debugging enabled.

Enabling Debugging

Alternatively, we have a different way to load up our website with debugging enabled. To do this:

  1. From the top menu, click Debug.
  2. Select Start Debugging.

This will bring you a prompt that looks like this:

Selecting the top option and clicking OK, we will enable debugging in the Web.Config file which will now look like this:

Notice that under the compilation options debug is now set to true, however to run this web site with debugging you will always have to either choose the Start Debugging option or simply hit the shortcut F5. This will allow you to add in breakpoints and utilize a lot of other functionality that is only available while debugging, which we will discuss in later parts of this tutorial series.
Download Source Files