J
JimLad
Hi,
I am so sorry to post this but I am utterly confused by this. I know
it's been asked a million times before but I just don't get it.
Click a button in an UpdatePanel. Goes to server side. Server side
errors. Exception is caught in Application_Error in Global.asax. Error
is logged... Error is cancelled.
When I try to redirect to an error page I am getting a
pagerequestmanagerservererrorexception instead.
Now - how do I redirect the ENTIRE page to an error page?
Response.Redirect doesn't seem to work, presumably because I'm
returning the request to an XMLHTTP object not the main page...
although I am a little confused as I thought I had this working.
Current code is:
Sub Application_Error(ByVal sender As Object, ByVal e As
EventArgs)
Dim referenceNumber As String
Dim friendlyMessage As String = Nothing
Dim severityLevel As ExceptionSeverity
If Context IsNot Nothing Then
Dim errMsg As String = String.Empty
Dim currentException As Exception = Server.GetLastError
().GetBaseException()
Dim additionalData As String = "Error caught in
Application_Error event in Global.asax." & vbCrLf
ErrorHandler.GetFriendlyMessageAndSeverityLevel
(currentException, friendlyMessage, severityLevel)
'Log error and get reference number.
referenceNumber = LogHandler.WriteException
(currentException, severityLevel, additionalData)
'Replace placemarker {0} with referenceNumber in friendly
message.
friendlyMessage = String.Format(friendlyMessage,
referenceNumber)
Session(SESSION_ERRORMESSAGE) = friendlyMessage
'Must clear error to stop an Unhandled Exception message
appearing in the Application Event Log.
Server.ClearError()
'Redirect to error page (do not endResponse as that stops
the Session variable from working)
Response.Redirect(Request.ApplicationPath & "/
PenscopeErrorPage.aspx", False)
End If
End Sub
Cheers,
James
I am so sorry to post this but I am utterly confused by this. I know
it's been asked a million times before but I just don't get it.
Click a button in an UpdatePanel. Goes to server side. Server side
errors. Exception is caught in Application_Error in Global.asax. Error
is logged... Error is cancelled.
When I try to redirect to an error page I am getting a
pagerequestmanagerservererrorexception instead.
Now - how do I redirect the ENTIRE page to an error page?
Response.Redirect doesn't seem to work, presumably because I'm
returning the request to an XMLHTTP object not the main page...
although I am a little confused as I thought I had this working.
Current code is:
Sub Application_Error(ByVal sender As Object, ByVal e As
EventArgs)
Dim referenceNumber As String
Dim friendlyMessage As String = Nothing
Dim severityLevel As ExceptionSeverity
If Context IsNot Nothing Then
Dim errMsg As String = String.Empty
Dim currentException As Exception = Server.GetLastError
().GetBaseException()
Dim additionalData As String = "Error caught in
Application_Error event in Global.asax." & vbCrLf
ErrorHandler.GetFriendlyMessageAndSeverityLevel
(currentException, friendlyMessage, severityLevel)
'Log error and get reference number.
referenceNumber = LogHandler.WriteException
(currentException, severityLevel, additionalData)
'Replace placemarker {0} with referenceNumber in friendly
message.
friendlyMessage = String.Format(friendlyMessage,
referenceNumber)
Session(SESSION_ERRORMESSAGE) = friendlyMessage
'Must clear error to stop an Unhandled Exception message
appearing in the Application Event Log.
Server.ClearError()
'Redirect to error page (do not endResponse as that stops
the Session variable from working)
Response.Redirect(Request.ApplicationPath & "/
PenscopeErrorPage.aspx", False)
End If
End Sub
Cheers,
James