Breakpoints can not be reached at random times

I'm trying to Debug my ASP.NET Application and I've set a couple of breakpoints. However, when I run the application in Debugger it runs right past the two breakpoints (i.e. there's a empty yellowish circle that shows up quickly over the first breakpoint but then the application runs) and therefore you cannot step-into the code to test it.
I also noticed that there is no "Rebuild" or "Clean" options under the "Build" website menu in VS 2005 like there is when I build Windows Forms applications. I'm relatively new to ASP.NET Development and am not sure why the breakpoints will not work. I would appreciate any experience on this dilemma. Below is a simple program and the Source code and C# Code behind code.
Thanks Experts,
Wally
------- Default.ASP Source Code ----------------
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="WelcomeLabel" runat="server" Text="Enter your name and travel details for this year or last year"
            Width="358px"></asp:Label><br /><br />
        <asp:TextBox ID="NameTextBox" runat="server"></asp:TextBox><br /><br />
        <asp:ListBox ID="CountryListBox" runat="server" SelectionMode="Multiple">
        </asp:ListBox><br /><br />
        <br />
        <asp:Button ID="ThisYearButton" runat="server" Text="Visted This Year" OnClick="TheButton_Click" /> &nbsp;
        <asp:Button ID="LastYearButton" runat="server" Text="Visited Last Year" /> <br /><br />
        <asp:Label ID="ResultLabel" runat="server"></asp:Label>
        <hr />
    </div>
        <asp:Label ID="TimestampLabel" runat="server"></asp:Label>
    </form>
</body>
</html>
-------------- Code Behind --------------------------
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
 
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            CountryListBox.Items.Add("Austrailia");
            CountryListBox.Items.Add("Canada");
            CountryListBox.Items.Add("France");
            CountryListBox.Items.Add("Germany");
        }
 
        TimestampLabel.Text = DateTime.Now.ToString();
    }
    protected void TheButton_Click(object sender, EventArgs e)
    {
        ResultLabel.Text += String.Format("Countries visted by {0}: <br />", NameTextBox.Text);
 
        foreach (ListItem item in CountryListBox.Items)
        {
            if (item.Selected)
            {
                ResultLabel.Text += "* " + item.Value + "<br />";
            }
        }
        ResultLabel.Text += "<br />";
    }
}

Open in new window

wally_davisAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wally_davisAuthor Commented:
FYI, This is a Website Project.
0
ppittleCommented:
Where are you putting your break points?
0
wally_davisAuthor Commented:
I'm starting out by putting my breakpoints at 1.  if (!IsPostBack) and 2. ResultLabel.Text += String.Format("Countries visted by {0}: <br />", NameTextBox.Text);
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

wally_davisAuthor Commented:
Just so you know, the entire web application runs in the IE 7.0 Browser and and I can fill out the textbox and ListBox and it postsback to the Local ASP.NET Server (Not using IIS) and it renders all the information in the final two ResultLabel.Text Labels.
0
ppittleCommented:
ASP.NET and VS can get a little odd when dealing with Websites.  ASP.NET will compile the site on first request and the version that the web server is using will not neccesarily be the version on the file system.  ASP.NET actually builds everythign out to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\.  This can be a bit of a pain until you get used to it, especially coming from windows development.

Try this:
1) Close IE and kill the Visual Stuio web Server (there's an icon for it in your system tray)
2) From Visual Studio goto Debug -> Start Debugging.  This should launch up a new version of the Visual Studio web server, rebuild your site, and Visual Studio should attach to the web server and you should be able to debug.

Alternatively, you may find it easier to use the Web Application template in Visual Studio as opposed to a web site (File -> New Project -> Web Application).  This template is similiar to a Windows or Console Application and doesn't have quite as many quirks as creating a Web Site.

HTH,

PJ
0
wally_davisAuthor Commented:
ppittle, I did everything you indicated, step by step, and even created a new "Web Application" , i.e. Choosing to create a Web Application Project vs. a New Web Site Project and still to no avail.
Again, the entire Web app was run during debug and postback occured after entering all the data in the two input controls.
I appreciate your help so far. Any other ideas?
0
wally_davisAuthor Commented:
Something else of interest. I noticed that no \Bin folder was created nor any *.pdb files, etc. are under the Project path at all.
0
ppittleCommented:
That's an interesting observation.  In your web.config, make sure you have this line:
<system.web>
      <compilation debug="True">
0
wally_davisAuthor Commented:
Yes, the compilation debug is set to true:

<?xml version="1.0"?>
 
<configuration>
  
    <appSettings/>
    <connectionStrings/>
  
    <system.web>
        <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.
        -->
        <compilation debug="true" />
        <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
        -->
        <authentication mode="Windows" />
        <!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.
 
        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
    </system.web>
</configuration>

Open in new window

0
wally_davisAuthor Commented:
Decided to try VS 2008 I have loaded on my PC. Moved my Website over from VS2005 and tested the breakpoints. Works perfect. Something must have gotten botched during the VS2005 Install.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ppittleCommented:
The tried and true re-install.  Sorry it came down to that, but glad to hear you got everything figured out.  Happy coding!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.