Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Error page not showing

Error page not showing

Scheduled Pinned Locked Moved ASP.NET
csharpsysadminhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andy Morris
    wrote on last edited by
    #1

    I have an error page set up and when an error occurs the page is not shown. From my webconfig file:

    From my Global aspx file:

    Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    ' Code that runs when an unhandled error occurs
    ' gets the error occured
    Dim ex As Exception = Server.GetLastError().GetBaseException()
    Try
    ' checks if the event source is registered
    If Not System.Diagnostics.EventLog.SourceExists(".NET Runtime") Then
    System.Diagnostics.EventLog.CreateEventSource(".NET Runtime", "Application")
    End If

        'log the details of the error occured
        Dim log As New System.Diagnostics.EventLog()
        log.Source = ".NET Runtime"
        log.WriteEntry(\[String\].Format(vbCr & vbLf & vbCr & vbLf & "Application Error" & vbCr & vbLf & vbCr & vbLf + "MESSAGE: {0}" &
                                       vbCr & vbLf + "SOURCE: {1}" & vbCr & vbLf + "FORM: {2}" & vbCr & vbLf + "QUERYSTRING: {3}" &
                                       vbCr & vbLf + "TARGETSITE: {4}" & vbCr & vbLf + "STACKTRACE: {5}" & vbCr
                                       & vbLf, ex.Message, ex.Source, Request.Form.ToString(), Request.QueryString.ToString(), ex.TargetSite, \_
         ex.StackTrace), System.Diagnostics.EventLogEntryType.\[Error\])
    
        Server.ClearError()
    Catch
        ' in case of exception occured in log
        Server.ClearError()
    End Try
    Server.ClearError()
    Response.Redirect(String.Format("Error.aspx?aspxerrorpath={0}", Request.Url.PathAndQuery))
    

    End Sub

    What I end up seeing is the master page and the URL shows / Error.aspx, but the error page is not shown with it.

    R 1 Reply Last reply
    0
    • A Andy Morris

      I have an error page set up and when an error occurs the page is not shown. From my webconfig file:

      From my Global aspx file:

      Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
      ' Code that runs when an unhandled error occurs
      ' gets the error occured
      Dim ex As Exception = Server.GetLastError().GetBaseException()
      Try
      ' checks if the event source is registered
      If Not System.Diagnostics.EventLog.SourceExists(".NET Runtime") Then
      System.Diagnostics.EventLog.CreateEventSource(".NET Runtime", "Application")
      End If

          'log the details of the error occured
          Dim log As New System.Diagnostics.EventLog()
          log.Source = ".NET Runtime"
          log.WriteEntry(\[String\].Format(vbCr & vbLf & vbCr & vbLf & "Application Error" & vbCr & vbLf & vbCr & vbLf + "MESSAGE: {0}" &
                                         vbCr & vbLf + "SOURCE: {1}" & vbCr & vbLf + "FORM: {2}" & vbCr & vbLf + "QUERYSTRING: {3}" &
                                         vbCr & vbLf + "TARGETSITE: {4}" & vbCr & vbLf + "STACKTRACE: {5}" & vbCr
                                         & vbLf, ex.Message, ex.Source, Request.Form.ToString(), Request.QueryString.ToString(), ex.TargetSite, \_
           ex.StackTrace), System.Diagnostics.EventLogEntryType.\[Error\])
      
          Server.ClearError()
      Catch
          ' in case of exception occured in log
          Server.ClearError()
      End Try
      Server.ClearError()
      Response.Redirect(String.Format("Error.aspx?aspxerrorpath={0}", Request.Url.PathAndQuery))
      

      End Sub

      What I end up seeing is the master page and the URL shows / Error.aspx, but the error page is not shown with it.

      R Offline
      R Offline
      Reza Ahmadi
      wrote on last edited by
      #2

      It seems that everything is fine but the address of Error.aspx is wrong as you say 'master page and the URL shows / Error.aspx'. I guess you must work on the last line:

      Response.Redirect(String.Format("Error.aspx?aspxerrorpath={0}", Request.Url.PathAndQuery))

      maybe you must replace it with "~/Error.aspx..."

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups