Solved

asp.net set "Debug=true"

Posted on 2010-09-15
8
665 Views
Last Modified: 2012-06-27
On m page I'm getting an error message along with the statement:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

I've included this at the top of my page:
<%@ Page Language="VB" Debug="true" AutoEventWireup="false" CodeFile="admin_whyjoin_update.aspx.vb" Inherits="_admin_whyjoin_update" ContentType="text/html" ResponseEncoding="utf-8" %>

and this in my web.config file:

<compilation debug="true" strict="false" explicit="true">
                  <assemblies>
                        <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                        <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                        <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                        <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                  </assemblies>
            </compilation>

But I'm still getting the error page telling me that my debug mode is off. Any ideas what I'm doing wrong? My page code is posted below. Thanks.
Code behind page (main page is below)
Imports System.Data.SqlClient
Imports System.Configuration

Partial Class _admin_whyjoin_update
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            LoadWhyJoin()
        End If
    End Sub

    Private Sub LoadWhyJoin()
        Dim conn As SqlConnection
        Dim comm As SqlCommand
        Dim reader As SqlDataReader
        Dim connectionString As String = _
        ConfigurationManager.ConnectionStrings( _
        "play3on3").ConnectionString
        conn = New SqlConnection(connectionString)
        comm = New SqlCommand( _
        "SELECT whyjoin " & _
        "FROM whyjoin " & _
        "WHERE id = 1", conn)
        Try
            conn.Open()
            reader = comm.ExecuteReader()
            If reader.Read() Then
                editor1.Text = reader.Item("whyjoin").ToString()
            End If
            reader.Close()
            updateButton.Enabled = True
        Catch
            dbErrorLabel.Text = _
            "Error loading the page content.<br />"
        Finally
            conn.Close()
        End Try
    End Sub

    Protected Sub updateButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles updateButton.Click
        Dim conn As SqlConnection
        Dim comm As SqlCommand
        Dim connectionString As String = _
        ConfigurationManager.ConnectionStrings( _
        "play3on3").ConnectionString
        conn = New SqlConnection(connectionString)
        comm = New SqlCommand( _
        "UPDATE whyjoin SET whyjoin=@whyjoin " & _
        "WHERE id=1", conn)
        comm.Parameters.Add("@whyjoin", System.Data.SqlDbType.Text)
        comm.Parameters("@whyjoin").Value = editor1.Text
        Try
            conn.Open()
            comm.ExecuteNonQuery()
        Catch
            dbErrorLabel.Text = _
            "Error updating the Why Join page.<br />"
        Finally
            conn.Close()
        End Try
        LoadWhyJoin()
    End Sub
End Class


Main page

<%@ Page Language="VB" Debug="true" AutoEventWireup="false" CodeFile="admin_whyjoin_update.aspx.vb" Inherits="_admin_whyjoin_update" ContentType="text/html" ResponseEncoding="utf-8" %>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<!-- Begin CKEditor Scripts -->
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script src="ckeditor/_samples/sample.js" type="text/javascript"></script>
<link href="ckeditor/_samples/sample.css" rel="stylesheet" type="text/css" />
<!-- End CKEditor Scripts -->
    
<link href="css/styles.css" rel="stylesheet" type="text/css" />

</head>

<body onload="MM_preloadImages('images/center_bar_on.png')">
<form id="form1" runat="server">
<!-- DO NOT MOVE! The following AllWebMenus linking code section must always be placed right AFTER the BODY tag-->
<!-- ******** BEGIN ALLWEBMENUS CODE FOR menu_play3on3_edit ******** -->
<script type="text/javascript">var MenuLinkedBy="AllWebMenus [4]",awmMenuName="menu_play3on3_edit",awmBN="798";awmAltUrl="";</script><script charset="UTF-8" src="menu_play3on3_edit.js" type="text/javascript"></script><script type="text/javascript">awmBuildMenu();</script>
<!-- ******** END ALLWEBMENUS CODE FOR menu_play3on3_edit ******** -->
<!-- <div style="height:100%;"> -->
  <div id="content_edit">&nbsp;<span id="awmAnchor-menu_play3on3_edit">&nbsp;</span></div>
  <div class="left column">
    <div id="leftcol">&nbsp;</div>
  </div>
<div class="right column">
    <div id="rightcol">&nbsp;</div>
</div>
<!-- </div> -->
<div class="main_content">
<div class="main_left_edit">  
</div>

<div class="main_center_edit">
  <div class="admin_content_top"><img src="images/spacer.png" alt="spacer" width="1" height="1" /></div>
  <div class="admin_content_middle">
  Edit content for the 
    <span class="admin_page_title">Why Join</span>
 page.
<p>
<asp:Label ID="dbErrorLabel" ForeColor="Red" runat="server" />
<br />
&nbsp;
<asp:TextBox ID="editor1" class="ckeditor" runat="server" Height="144px" 
        TextMode="MultiLine" Width="809px"></asp:TextBox>
<br />
</p>
<p>
<asp:Button ID="updateButton" Text="Update Why Join Page" Width="200" 
        Enabled="False" runat="server" />
</p>
</div>
<div class="admin_content_bottom"><img src="images/spacer.png" alt="spacer" width="1" height="1" /></div>
</div>


<div class="main_right_edit">
 
</div>
</div>

<div class="clear">&nbsp;</div>
<div class="footer_bg">
  <div class="footer_center">&nbsp;</div>

</div>
</form>
</body>
</html>

Open in new window

0
Comment
Question by:elliottbenzle
  • 3
  • 3
  • 2
8 Comments
 
LVL 9

Accepted Solution

by:
TonyReba earned 500 total points
ID: 33688284
actually you only need these in you aspx page to debug it...

<%@ Page Language="VB" Debug="true" AutoEventWireup="false" CodeFile="admin_whyjoin_update.aspx.vb" Inherits="_admin_whyjoin_update" ContentType="text/html" ResponseEncoding="utf-8" %>
0
 
LVL 9

Expert Comment

by:TonyReba
ID: 33688290
try also running the application with F5 ,or click on the top menu,,
Debug> Star Debugging
0
 
LVL 4

Expert Comment

by:timexist
ID: 33688349
it is talk about web.config file.
you should set debug = ture there.
0
 
LVL 4

Expert Comment

by:timexist
ID: 33688362

press F10 is step by step debug but step over functions.
press F11 will go every steps.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 9

Expert Comment

by:TonyReba
ID: 33688363
yes he is doing that
 in:


<compilation debug="true" strict="false" explicit="true">
0
 
LVL 4

Expert Comment

by:timexist
ID: 33688437
Yeah, I think a reboot maybe needed, as there is no setup error for debugging.
0
 
LVL 8

Expert Comment

by:Mohit Vijay
ID: 33688524
1. check, a pdb file should also be in bin/debug folder.
2. check if your configuration mode is release or debug? if its release change it to debug.
3. Yes, You only need to set debug mode in web.config level, it will apply debugging true for all pages, but if you setting it page level, it will page by page.
0
 
LVL 8

Expert Comment

by:Mohit Vijay
ID: 33688526
if make debug="false" you will not get this error, but you will not be able to debug your application.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now