Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 689
  • Last Modified:

asp.net set "Debug=true"

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
elliottbenzle
Asked:
elliottbenzle
  • 3
  • 3
  • 2
1 Solution
 
TonyRebaCommented:
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
 
TonyRebaCommented:
try also running the application with F5 ,or click on the top menu,,
Debug> Star Debugging
0
 
timexistCommented:
it is talk about web.config file.
you should set debug = ture there.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
timexistCommented:

press F10 is step by step debug but step over functions.
press F11 will go every steps.
0
 
TonyRebaCommented:
yes he is doing that
 in:


<compilation debug="true" strict="false" explicit="true">
0
 
timexistCommented:
Yeah, I think a reboot maybe needed, as there is no setup error for debugging.
0
 
Mohit VijayCommented:
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
 
Mohit VijayCommented:
if make debug="false" you will not get this error, but you will not be able to debug your application.
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now