Runtime Error

Discussion in 'ASP.NET / ASP.NET Core' started by calvin, Oct 31, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I get this error message after I publish all my file to my web server. The program was running in localhost[:)]. I have try to change the customErrors mode to "Off" or "RemoteOnly" with defaultRedirect page in WebConfig file. But I still get this error[xx(]. I think there is no problem in Webconfig file.[?]

    Anybody can solve this problem to me, thanks.[:D]

    Server Error in '/' Application.
    ---------------------------------------------------------------------

    Runtime Error
    Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

    Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


    <!-- Web.Config Configuration File -->

    <configuration>
    <system.web>
    <customErrors mode="Off"/>
    </system.web>
    </configuration>


    Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


    <!-- Web.Config Configuration File -->

    <configuration>
    <system.web>
    <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
    </configuration>
     
  2. that looks right. im assuming you only posted a snipet of the config file? if not, you need to add this line to the top of the config file which identifies the encoding and xml version:



    otherwise, im not sure what IDE you are using but it should autogenerate a config file for you when you start a new project. try doing that and using it.

    hth
    matt
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    This usually means that there's an error in the web.config file itself.


    quote:Originally posted by calvin

    I get this error message after I publish all my file to my web server. The program was running in localhost[:)]. I have try to change the customErrors mode to "Off" or "RemoteOnly" with defaultRedirect page in WebConfig file. But I still get this error[xx(]. I think there is no problem in Webconfig file.[?]

    Anybody can solve this problem to me, thanks.[:D]

    Server Error in '/' Application.
    ---------------------------------------------------------------------

    Runtime Error
    Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

    Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


    <!-- Web.Config Configuration File -->

    <configuration>
    <system.web>
    <customErrors mode="Off"/>
    </system.web>
    </configuration>


    Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


    <!-- Web.Config Configuration File -->

    <configuration>
    <system.web>
    <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
    </configuration>




    </blockquote id="quote"></font id="quote">
     
  4. tiz

    tiz

    I have the exact same error!!! and it's driving me crazy!! if someone can please help me, i really really apprecciate it!!!
     
  5. try to post your complete web.config file here, so we can check it. Otherwise it is hard to guess.

    --
    Steurm
    www.steurm.net/steurm
     
  6. Bruce

    Bruce DiscountASP.NET Staff

    You posted the wrong file.

    The error is cause by your config file not the aspx file.

    Please post the content of the file named web.config.

    quote:Originally posted by garrydawkins

    Imports System
    Imports System.Configuration
    Imports System.Data
    Imports System.Data.SqlClient
    Imports System.Text

    Public Class NPD_QueryForm_2003
    Inherits System.Web.UI.Page

    Dim dsQuery As DataSet
    Protected WithEvents btnRunQuery As System.Web.UI.WebControls.Button
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Protected WithEvents LinkButton1 As System.Web.UI.WebControls.LinkButton
    Protected WithEvents tbxSaveQuery As System.Web.UI.WebControls.TextBox
    Protected WithEvents ddLoadQuery As System.Web.UI.WebControls.DropDownList
    Dim oQuery As NPD.Query
    Protected WithEvents hdnCookieExistsFlag As System.Web.UI.HtmlControls.HtmlInputHidden
    Protected WithEvents litJava As System.Web.UI.WebControls.Literal
    Protected WithEvents hClearAll As System.Web.UI.WebControls.HyperLink
    Protected WithEvents Treescripts As System.Web.UI.WebControls.Literal


    #Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    End Sub

    #End Region

    Dim strControlList As String



    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ''Response.Redirect(Request.ApplicationPath & "/UnderConstruction.aspx")
    Session("PostCount") = 0
    ' If Cache("QueryForm") Is Nothing Then
    Dim strScript As String
    Dim strScriptSrc As String
    strScriptSrc = Context.Request.ApplicationPath & "/Includes/NPD_Utilities.js"
    strScript = "<script src='" & strScriptSrc & "'></script>"
    If (Not IsClientScriptBlockRegistered("NPDQ")) Then
    RegisterClientScriptBlock("NPDQ", strScript)
    End If
    If Not IsPostBack Then
    DoScripts()
    oQuery = New NPD.Query
    oQuery.DB = Session("DB")
    oQuery.LoadQuery(Page)
    oQuery = Nothing
    Cache("QueryForm") = Me.Page
    Else
    'Dim strNSF = Request.Form("NPD_Query:Edit_Primary_Stressors1:tLabel1New")
    'Dim strEcosystems = Request.Form("NPD_Query:Edit_Primary_Stressors1:tLabel1New")
    'Dim strspNOAA = Request.Form("NPD_Query:Edit_Primary_Stressors1:tLabel1New")
    'Dim strspNOS = Request.Form("NPD_Query:Edit_Primary_Stressors1:tLabel1New")
    'Dim strspNCCOS = Request.Form("NPD_Query:Edit_Primary_Stressors1:tLabel1New")
    End If
    ' Else
    ' Me.Page = Cache("QueryForm")
    End Sub


    Sub DoScripts()
    Dim intCounter As Integer
    Dim strTreeScripts As String
    Dim sTree As String
    Dim sLabel As String
    Dim treecontrols(3) As String
    treecontrols(0) = "NPD_Query1_Edit_Primary_Stressors1"
    treecontrols(1) = "NPD_Query1_Edit_ecosystems2"
    treecontrols(2) = "NPD_Query1_Edit_NSF1"
    strTreeScripts = "<script language='javascript'>"
    strTreeScripts &= "window.onload=function(){"
    For intCounter = 0 To 2
    sTree = treecontrols(intCounter)
    strTreeScripts &= "LoadTreeValues('" & sTree & "_NPDTree1_TreeNPD','" & sTree & "_tLabel1','old');"
    strTreeScripts &= "CollapseAllNodes(document.getElementById('" & sTree & "_NPDTree1_TreeNPD'));"
    ' strTreeScripts &= "debugger;"
    Next
    For intCounter = 1 To 2
    sTree = "NPD_Query1_Edit_StrategicPlans_2003_NPDTree" & intCounter & "_TreeNPD"
    sLabel = "NPD_Query1_Edit_StrategicPlans_2003_tLabel" & intCounter
    strTreeScripts &= "LoadTreeValues('" & sTree & "','" & sLabel & "','old');"
    strTreeScripts &= "CollapseAllNodes(document.getElementById('" & sTree & "'));"
    'strTreeScripts &= "document.getElementById('QueryMenu1_lblStatus').innerHTML='';"
    Next
    strTreeScripts &= "}"
    strTreeScripts &= "</script>"
    Me.Treescripts.Text = strTreeScripts

    End Sub


    Sub OpenQueryResults()
    Dim ctl As Control
    Dim oOutput As RadioButtonList
    Dim strForm As String
    Dim strQueryString As String
    Dim intCounter As Integer
    Dim strX As String
    Dim strY As String
    oOutput = FindControl("QueryMenu1:rbOutput")
    Dim ds As DataSet
    ds = Cache("Query")
    If ds.Tables(0).Rows.Count = 0 Then
    Exit Sub
    End If
    Select Case oOutput.SelectedItem.Value
    Case 0
    strForm = "../QueryResults.aspx"
    Case 1
    Session("ChartTitle") = "NPD Incoming Fund Report"
    strX = "xValues="
    strY = "yValues="
    For intCounter = 0 To ds.Tables(0).Rows.Count - 1
    strX &= ds.Tables(0).Rows(intCounter).Item(0) & "|"
    If IsDBNull(ds.Tables(0).Rows(intCounter).Item(1)) Then
    strY &= "0|"
    Else
    strY &= ds.Tables(0).Rows(intCounter).Item(1) & "|"
    End If
    Next
    strX = Left(strX, Len(strX) - 1)
    strY = Left(strY, Len(strX) - 1)
    strQueryString &= strX & "&"
    strQueryString &= strY & "&"
    strQueryString &= "chartType=pie&"
    strQueryString &= "Print=False"
    strForm = "../ChartGenerator.aspx?" & strQueryString
    Case 2
    strForm = "rptOutgoing.aspx"
    Case 3
    strForm = "rptIncomingvsOutgoing.aspx"
    End Select
    ds = Nothing
    Dim sScript As String = "<SCRIPT language='javascript'>" & _
    "PopUpLookup('" & Request.ApplicationPath & "/QueryResults.aspx');" & _
    "</SCRIPT>"
    litJava.Text = sScript
    End Sub

    Private Sub btnRunQuery_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRunQuery.Click
    oQuery = New NPD.Query
    oQuery.DB = Session("DB")

    dsQuery = oQuery.ExecuteQuery(Page)
    '''Save control settings to custom cookie
    Cache("Query") = dsQuery

    If Me.tbxSaveQuery.Text <> "" Then
    Dim strName As String = tbxSaveQuery.Text & "@" & Session("DB") & "@" & Session("ID") & "@" & Session("UserID") & "@" & DateTime.Now.ToString
    Dim objSavecookie As HttpCookie = New HttpCookie(tbxSaveQuery.Text & "|" & Session("DB"), strName)
    objSavecookie.Expires = DateTime.Now().AddYears(1)
    Response.Cookies.Add(objSavecookie)
    Dim intCounter As Integer
    Dim sbQuery As StringBuilder = New StringBuilder
    For intCounter = 0 To oQuery.SaveCookie.Count - 1
    Dim sControl As String = oQuery.SaveCookie(intCounter)
    sControl.Trim()
    sControl.Replace("'", "''")
    sbQuery.Append(sControl)
    Next

    Dim objdb As DBAccess.DAOObject = New DBAccess.DAOObject
    objdb.DB = Session("DB")
    Session("QueryPlainLanguage") = oQuery.EnglishPlain

    Try

    Dim strSQL As String = "INSERT INTO dbo.NPD_USER_QUERIES(QName, QueryControls, UserID,EnglishPlain) " & _
    "VALUES ('" & strName & "','" & sbQuery.ToString & "'," & Session("UserID") & ",'" & oQuery.EnglishPlain.Replace("'", "''") & "')"
    objdb.RunActionQuery(strSQL)
    objdb = Nothing

    Catch

    End Try


    Try
    Cache.Insert("Query", dsQuery, Nothing, DateTime.MaxValue, _
    TimeSpan.FromMinutes(20))
    Catch
    End Try
    End If

    oQuery = Nothing
    dsQuery = Nothing
    OpenQueryResults()

    End Sub


    Sub LoadQuery(Optional ByVal strQueryName As String = "")
    If strQueryName <> "" Then
    Dim objdb As DBAccess.DAOObject = New DBAccess.DAOObject
    objdb.DB = Session("DB")

    Dim dr As SqlDataReader
    Dim strSQL As String
    strSQL = "SELECT * FROM NPD_USER_QUERIES WHERE USERID= " & Session("UserID") & _
    " AND QName = '" & strQueryName & "'"

    dr = objdb.RunPassSQL(strSQL)

    Do While objdb.myConnection.State = ConnectionState.Executing

    Loop
    Dim sControl As String

    While dr.Read
    sControl = dr("QueryControls")
    End While
    dr.Close()

    LoadControls(sControl)


    End If

    End Sub



    Sub LoadControls(ByVal sControlString As String)

    Dim itm As ListItem
    Dim strItem As String
    Dim InFlag As Boolean
    Dim strTableQuery() As String
    Dim strTableQuery1() As String
    Dim intCount As Integer
    Dim s As Object
    Dim sControls() As String
    sControls = sControlString.Split("^")
    Dim sControl() As String
    Dim sControlType As String
    Dim sControlName As String
    Dim sControlValue As String
    Dim _sControlValue() As String
    Dim strType As String
    Dim intCounter As Integer


    For intCounter = 0 To UBound(sControls) - 1

    sControl = Split(sControls(intCounter), "|")
    sControlName = sControl(1).ToString
    sControlValue = sControl(2).ToString
    s = FindControl(sControlName)

    Try
    strType = s.GetType().ToString()
    Catch e As Exception
    Dim strerror As String = e.ToString
    End Try


    Select Case strType

    'Case "System.Web.UI.WebControls.RadioButtonList"
    ' Dim oRadioButtonList As RadioButtonList = s
    ' oRadioButtonList.Items.FindByValue(Convert.ToString(sControlValue)).Selected = True
    Case "System.Web.UI.WebControls.TextBox"
    Dim oTextBox As TextBox = s
    oTextBox.Text = sControlValue
    Case "System.Web.UI.HtmlControls.HtmlInputControl"
    Dim oInput As System.Web.UI.HtmlControls.HtmlInputControl = s

    oInput.Value = sControls(2)
    Case "System.Web.UI.WebControls.ListControl"
    Dim oListbox As ListBox = s
    Dim i As Integer
    _sControlValue = sControlValue.Split(",")
    Dim j As Integer
    For j = 0 To oListbox.Items.Count - 1
    oListbox.Items(j).Selected = False
    Next
    For i = 0 To UBound(_sControlValue)
    Try
    oListbox.Items.FindByValue(Convert.ToString(_sControlValue(i))).Selected = True
    Catch
    End Try
    Next
    End Select


    Next


    End Sub

    Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
    Dim strKey As String
    'ddLoadQuery.Items.Clear()

    For Each strKey In Request.Cookies
    If strKey.IndexOf(Session("DB")) > 0 Then
    Dim sKey() As String = Split(strKey, "|")
    Dim dditem As ListItem = New ListItem
    Try

    If ddLoadQuery.Items.IndexOf(ddLoadQuery.Items.FindByValue(Convert.ToString(sKey(0)))) Then
    dditem.Text = sKey(0)
    dditem.Value = Request.Cookies(strKey).Value
    ddLoadQuery.Items.Add(dditem)

    End If

    Catch
    End Try


    End If
    Next
    'tbxSaveQuery.Text = ddLoadQuery.SelectedItem.Text
    ' tbxSaveQuery.Attributes.Add("ontextchanged", "javascript:CookieExists('" & tbxSaveQuery.Text & "@" & Session("NPD") & "','" & hdnCookieExistsFlag.ClientID & "');")

    End Sub



    Private Sub ddLoadQuery_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddLoadQuery.SelectedIndexChanged
    LoadQuery(ddLoadQuery.SelectedValue)
    End Sub


    Private Sub ClearAll(ByVal strJScript As String)


    End Sub


    End Class
    [}:)]
    </blockquote id="quote"></font id="quote">
     
  7. Imports System
    Imports System.Configuration
    Imports System.Data
    Imports System.Data.SqlClient
    Imports System.Text

    Public Class NPD_QueryForm_2003
    Inherits System.Web.UI.Page

    Dim dsQuery As DataSet
    Protected WithEvents btnRunQuery As System.Web.UI.WebControls.Button
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Protected WithEvents LinkButton1 As System.Web.UI.WebControls.LinkButton
    Protected WithEvents tbxSaveQuery As System.Web.UI.WebControls.TextBox
    Protected WithEvents ddLoadQuery As System.Web.UI.WebControls.DropDownList
    Dim oQuery As NPD.Query
    Protected WithEvents hdnCookieExistsFlag As System.Web.UI.HtmlControls.HtmlInputHidden
    Protected WithEvents litJava As System.Web.UI.WebControls.Literal
    Protected WithEvents hClearAll As System.Web.UI.WebControls.HyperLink
    Protected WithEvents Treescripts As System.Web.UI.WebControls.Literal


    #Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    End Sub

    #End Region

    Dim strControlList As String



    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ''Response.Redirect(Request.ApplicationPath & "/UnderConstruction.aspx")
    Session("PostCount") = 0
    ' If Cache("QueryForm") Is Nothing Then
    Dim strScript As String
    Dim strScriptSrc As String
    strScriptSrc = Context.Request.ApplicationPath & "/Includes/NPD_Utilities.js"
    strScript = "<script src='" & strScriptSrc & "'></script>"
    If (Not IsClientScriptBlockRegistered("NPDQ")) Then
    RegisterClientScriptBlock("NPDQ", strScript)
    End If
    If Not IsPostBack Then
    DoScripts()
    oQuery = New NPD.Query
    oQuery.DB = Session("DB")
    oQuery.LoadQuery(Page)
    oQuery = Nothing
    Cache("QueryForm") = Me.Page
    Else
    'Dim strNSF = Request.Form("NPD_Query:Edit_Primary_Stressors1:tLabel1New")
    'Dim strEcosystems = Request.Form("NPD_Query:Edit_Primary_Stressors1:tLabel1New")
    'Dim strspNOAA = Request.Form("NPD_Query:Edit_Primary_Stressors1:tLabel1New")
    'Dim strspNOS = Request.Form("NPD_Query:Edit_Primary_Stressors1:tLabel1New")
    'Dim strspNCCOS = Request.Form("NPD_Query:Edit_Primary_Stressors1:tLabel1New")
    End If
    ' Else
    ' Me.Page = Cache("QueryForm")
    End Sub


    Sub DoScripts()
    Dim intCounter As Integer
    Dim strTreeScripts As String
    Dim sTree As String
    Dim sLabel As String
    Dim treecontrols(3) As String
    treecontrols(0) = "NPD_Query1_Edit_Primary_Stressors1"
    treecontrols(1) = "NPD_Query1_Edit_ecosystems2"
    treecontrols(2) = "NPD_Query1_Edit_NSF1"
    strTreeScripts = "<script language='javascript'>"
    strTreeScripts &= "window.onload=function(){"
    For intCounter = 0 To 2
    sTree = treecontrols(intCounter)
    strTreeScripts &= "LoadTreeValues('" & sTree & "_NPDTree1_TreeNPD','" & sTree & "_tLabel1','old');"
    strTreeScripts &= "CollapseAllNodes(document.getElementById('" & sTree & "_NPDTree1_TreeNPD'));"
    ' strTreeScripts &= "debugger;"
    Next
    For intCounter = 1 To 2
    sTree = "NPD_Query1_Edit_StrategicPlans_2003_NPDTree" & intCounter & "_TreeNPD"
    sLabel = "NPD_Query1_Edit_StrategicPlans_2003_tLabel" & intCounter
    strTreeScripts &= "LoadTreeValues('" & sTree & "','" & sLabel & "','old');"
    strTreeScripts &= "CollapseAllNodes(document.getElementById('" & sTree & "'));"
    'strTreeScripts &= "document.getElementById('QueryMenu1_lblStatus').innerHTML='';"
    Next
    strTreeScripts &= "}"
    strTreeScripts &= "</script>"
    Me.Treescripts.Text = strTreeScripts

    End Sub


    Sub OpenQueryResults()
    Dim ctl As Control
    Dim oOutput As RadioButtonList
    Dim strForm As String
    Dim strQueryString As String
    Dim intCounter As Integer
    Dim strX As String
    Dim strY As String
    oOutput = FindControl("QueryMenu1:rbOutput")
    Dim ds As DataSet
    ds = Cache("Query")
    If ds.Tables(0).Rows.Count = 0 Then
    Exit Sub
    End If
    Select Case oOutput.SelectedItem.Value
    Case 0
    strForm = "../QueryResults.aspx"
    Case 1
    Session("ChartTitle") = "NPD Incoming Fund Report"
    strX = "xValues="
    strY = "yValues="
    For intCounter = 0 To ds.Tables(0).Rows.Count - 1
    strX &= ds.Tables(0).Rows(intCounter).Item(0) & "|"
    If IsDBNull(ds.Tables(0).Rows(intCounter).Item(1)) Then
    strY &= "0|"
    Else
    strY &= ds.Tables(0).Rows(intCounter).Item(1) & "|"
    End If
    Next
    strX = Left(strX, Len(strX) - 1)
    strY = Left(strY, Len(strX) - 1)
    strQueryString &= strX & "&"
    strQueryString &= strY & "&"
    strQueryString &= "chartType=pie&"
    strQueryString &= "Print=False"
    strForm = "../ChartGenerator.aspx?" & strQueryString
    Case 2
    strForm = "rptOutgoing.aspx"
    Case 3
    strForm = "rptIncomingvsOutgoing.aspx"
    End Select
    ds = Nothing
    Dim sScript As String = "<SCRIPT language='javascript'>" & _
    "PopUpLookup('" & Request.ApplicationPath & "/QueryResults.aspx');" & _
    "</SCRIPT>"
    litJava.Text = sScript
    End Sub

    Private Sub btnRunQuery_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRunQuery.Click
    oQuery = New NPD.Query
    oQuery.DB = Session("DB")

    dsQuery = oQuery.ExecuteQuery(Page)
    '''Save control settings to custom cookie
    Cache("Query") = dsQuery

    If Me.tbxSaveQuery.Text <> "" Then
    Dim strName As String = tbxSaveQuery.Text & "@" & Session("DB") & "@" & Session("ID") & "@" & Session("UserID") & "@" & DateTime.Now.ToString
    Dim objSavecookie As HttpCookie = New HttpCookie(tbxSaveQuery.Text & "|" & Session("DB"), strName)
    objSavecookie.Expires = DateTime.Now().AddYears(1)
    Response.Cookies.Add(objSavecookie)
    Dim intCounter As Integer
    Dim sbQuery As StringBuilder = New StringBuilder
    For intCounter = 0 To oQuery.SaveCookie.Count - 1
    Dim sControl As String = oQuery.SaveCookie(intCounter)
    sControl.Trim()
    sControl.Replace("'", "''")
    sbQuery.Append(sControl)
    Next

    Dim objdb As DBAccess.DAOObject = New DBAccess.DAOObject
    objdb.DB = Session("DB")
    Session("QueryPlainLanguage") = oQuery.EnglishPlain

    Try

    Dim strSQL As String = "INSERT INTO dbo.NPD_USER_QUERIES(QName, QueryControls, UserID,EnglishPlain) " & _
    "VALUES ('" & strName & "','" & sbQuery.ToString & "'," & Session("UserID") & ",'" & oQuery.EnglishPlain.Replace("'", "''") & "')"
    objdb.RunActionQuery(strSQL)
    objdb = Nothing

    Catch

    End Try


    Try
    Cache.Insert("Query", dsQuery, Nothing, DateTime.MaxValue, _
    TimeSpan.FromMinutes(20))
    Catch
    End Try
    End If

    oQuery = Nothing
    dsQuery = Nothing
    OpenQueryResults()

    End Sub


    Sub LoadQuery(Optional ByVal strQueryName As String = "")
    If strQueryName <> "" Then
    Dim objdb As DBAccess.DAOObject = New DBAccess.DAOObject
    objdb.DB = Session("DB")

    Dim dr As SqlDataReader
    Dim strSQL As String
    strSQL = "SELECT * FROM NPD_USER_QUERIES WHERE USERID= " & Session("UserID") & _
    " AND QName = '" & strQueryName & "'"

    dr = objdb.RunPassSQL(strSQL)

    Do While objdb.myConnection.State = ConnectionState.Executing

    Loop
    Dim sControl As String

    While dr.Read
    sControl = dr("QueryControls")
    End While
    dr.Close()

    LoadControls(sControl)


    End If

    End Sub



    Sub LoadControls(ByVal sControlString As String)

    Dim itm As ListItem
    Dim strItem As String
    Dim InFlag As Boolean
    Dim strTableQuery() As String
    Dim strTableQuery1() As String
    Dim intCount As Integer
    Dim s As Object
    Dim sControls() As String
    sControls = sControlString.Split("^")
    Dim sControl() As String
    Dim sControlType As String
    Dim sControlName As String
    Dim sControlValue As String
    Dim _sControlValue() As String
    Dim strType As String
    Dim intCounter As Integer


    For intCounter = 0 To UBound(sControls) - 1

    sControl = Split(sControls(intCounter), "|")
    sControlName = sControl(1).ToString
    sControlValue = sControl(2).ToString
    s = FindControl(sControlName)

    Try
    strType = s.GetType().ToString()
    Catch e As Exception
    Dim strerror As String = e.ToString
    End Try


    Select Case strType

    'Case "System.Web.UI.WebControls.RadioButtonList"
    ' Dim oRadioButtonList As RadioButtonList = s
    ' oRadioButtonList.Items.FindByValue(Convert.ToString(sControlValue)).Selected = True
    Case "System.Web.UI.WebControls.TextBox"
    Dim oTextBox As TextBox = s
    oTextBox.Text = sControlValue
    Case "System.Web.UI.HtmlControls.HtmlInputControl"
    Dim oInput As System.Web.UI.HtmlControls.HtmlInputControl = s

    oInput.Value = sControls(2)
    Case "System.Web.UI.WebControls.ListControl"
    Dim oListbox As ListBox = s
    Dim i As Integer
    _sControlValue = sControlValue.Split(",")
    Dim j As Integer
    For j = 0 To oListbox.Items.Count - 1
    oListbox.Items(j).Selected = False
    Next
    For i = 0 To UBound(_sControlValue)
    Try
    oListbox.Items.FindByValue(Convert.ToString(_sControlValue(i))).Selected = True
    Catch
    End Try
    Next
    End Select


    Next


    End Sub

    Private Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRender
    Dim strKey As String
    'ddLoadQuery.Items.Clear()

    For Each strKey In Request.Cookies
    If strKey.IndexOf(Session("DB")) > 0 Then
    Dim sKey() As String = Split(strKey, "|")
    Dim dditem As ListItem = New ListItem
    Try

    If ddLoadQuery.Items.IndexOf(ddLoadQuery.Items.FindByValue(Convert.ToString(sKey(0)))) Then
    dditem.Text = sKey(0)
    dditem.Value = Request.Cookies(strKey).Value
    ddLoadQuery.Items.Add(dditem)

    End If

    Catch
    End Try


    End If
    Next
    'tbxSaveQuery.Text = ddLoadQuery.SelectedItem.Text
    ' tbxSaveQuery.Attributes.Add("ontextchanged", "javascript:CookieExists('" & tbxSaveQuery.Text & "@" & Session("NPD") & "','" & hdnCookieExistsFlag.ClientID & "');")

    End Sub



    Private Sub ddLoadQuery_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddLoadQuery.SelectedIndexChanged
    LoadQuery(ddLoadQuery.SelectedValue)
    End Sub


    Private Sub ClearAll(ByVal strJScript As String)


    End Sub


    End Class
    [}:)]
     
  8. Calvin,

    There isn't necessarily a problem with your web.config file. The error message that you are seeing is a generic .NET error message that prevents sensitive information from being disclosed to the general public.

    Specifically, the mode attribute of the <customErrors> node has three possible values:

    RemoteOnly - This is the default value. When the mode attribute is set to RemoteOnly, any custom error codes that you elect to handle will only take effect for remote requests (requests that don't originate from the local machine). The problem is that you don't have terminal access to the server that your site is hosted on, so RemoteOnly has the effect of displaying a generic error message for all requests.

    On - When the mode attribute is set to On, ALL requests (local and remote) use the defined error settings inside of the <customErrors> node.

    Off - When the mode attribute is set to Off, ALL requests (local and remote) will display the standard ASP.NET debug information when an error occurs. This isn't a setting that you want to use in production, as it provides the general public with a very ugly error message, and potentially opens you up to security holes (by way of exposing application code in the error message).

    To debug your problem, you'll want to turn the mode attribute of the <customErrors> tag to Off temporarily. This will enable ASP.NET to spit out a concise error message informing you of the exact location of the error. If specific error information isn't provided (it should show you the exact line number where the error is occurring), you may need to turn the debug attribute of the <compiler> node on (<compiler defaultLanguage="VB" debug="true" />) in order to see the full debug information.

    Of course, once you resolve the error, you should change the debug attribute back to false, and turn mode attribute of the customErrors tag to either RemoteOnly or On.

    Let me know if this helps.

    Thanks,
    Brian Weller





    quote:Originally posted by calvin

    I get this error message after I publish all my file to my web server. The program was running in localhost[:)]. I have try to change the customErrors mode to "Off" or "RemoteOnly" with defaultRedirect page in WebConfig file. But I still get this error[xx(]. I think there is no problem in Webconfig file.[?]

    Anybody can solve this problem to me, thanks.[:D]

    Server Error in '/' Application.
    ---------------------------------------------------------------------

    Runtime Error
    Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

    Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


    <!-- Web.Config Configuration File -->

    <configuration>
    <system.web>
    <customErrors mode="Off"/>
    </system.web>
    </configuration>


    Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


    <!-- Web.Config Configuration File -->

    <configuration>
    <system.web>
    <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
    </configuration>




    </blockquote id="quote"></font id="quote">
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page