Re: .NET Remoting Exception handling
From: mb (anonymous_at_discussions.microsoft.com)
Date: 05/14/04
- Previous message: mb: "Re: Console App runs OK Windows Service Fails"
- In reply to: Arjun periannan: "Re: .NET Remoting Exception handling"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 14 May 2004 13:31:04 -0700
one way to handle this to put add page_error event and use the following code snippet to capture and display the error:
In my app, I redirected to generic error page and in its page. It works fine ...
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
Dim LastError As Exception
Dim ErrMessage As String
LastError = Server.GetLastError()
If Not LastError Is Nothing Then
If TypeOf LastError Is System.Web.HttpException Then
LastError = LastError.GetBaseException
End If
ErrMessage = "Following error occured:" + Environment.NewLine
If TypeOf LastError Is System.Net.Sockets.SocketException Then
'Remoting Error - Not able to establish connection to Remoting server.
'Need to display friendlier message.
ErrMessage = "Application Server connectivity error." + Environment.NewLine
Else
'Standard exception - Could be from DB or anything.
ErrMessage = LastError.Message + Environment.NewLine
End If
ErrMessage = ErrMessage + "<br>"
ErrMessage = ErrMessage + "Please try again. If problem persists, please contact product office for support."
ErrMessage = ErrMessage + "<br>"
ErrMessage = ErrMessage + "<br>"
ErrMessage = ErrMessage + "<br>"
ErrMessage = ErrMessage + "<br>"
ErrMessage = ErrMessage + "<br>"
ErrMessage = ErrMessage + "<br>"
Else
ErrMessage = "No Errors"
End If
Server.ClearError()
lblErrorText.Text = ErrMessage
End If
End Sub
Regards
MB
persmb@put the domain listed below to contact me.
comcast.net
- Previous message: mb: "Re: Console App runs OK Windows Service Fails"
- In reply to: Arjun periannan: "Re: .NET Remoting Exception handling"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|