Solved

asp.net set "Debug=true"

Posted on 2010-09-15
8
662 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
Comment Utility
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
Comment Utility
try also running the application with F5 ,or click on the top menu,,
Debug> Star Debugging
0
 
LVL 4

Expert Comment

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

Expert Comment

by:timexist
Comment Utility

press F10 is step by step debug but step over functions.
press F11 will go every steps.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 9

Expert Comment

by:TonyReba
Comment Utility
yes he is doing that
 in:


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

Expert Comment

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

Expert Comment

by:Mohit Vijay
Comment Utility
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
Comment Utility
if make debug="false" you will not get this error, but you will not be able to debug your application.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

9 Experts available now in Live!

Get 1:1 Help Now