?
Solved

asp.net set "Debug=true"

Posted on 2010-09-15
8
Medium Priority
?
685 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 9

Accepted Solution

by:
TonyReba earned 2000 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
How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

 
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
 
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

719 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