Re: .NET Remoting Exception handling

From: mb (anonymous_at_discussions.microsoft.com)
Date: 05/14/04

  • Next message: Yuancai \(Charlie\) Ye: "Re: Passing a dataset from Client to a Remoted object"
    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


  • Next message: Yuancai \(Charlie\) Ye: "Re: Passing a dataset from Client to a Remoted object"

    Relevant Pages

    • Re: Sound recording - HELP!
      ... maybe this would be a great app to get my ... listing on the radio. ... Private Sub StartRecording() ... mciSimpleSendString("open new type waveaudio alias capture") ...
      (microsoft.public.dotnet.languages.vb)
    • Open a form using ActiveX dll from another Application
      ... main app. ... Public Property Let ClientPhoneNo ... Private Sub Toolbar1_ButtonClick ... Dim sPhoneNo As String ...
      (microsoft.public.vb.general.discussion)
    • RE: From Help
      ... To see how my approach works, create a new document called Test1. ... This will create a user form named UserForm1. ... Private Sub CommandButton1_Click ... This should display the code for the Document_New ...
      (microsoft.public.word.vba.general)
    • Re: Combo Box text display problem based on AfterUpdate...
      ... Private Sub Form_Current ... The cboStore and cboEmployee display fine. ... "Ken Snell " wrote: ... <MS ACCESS MVP> ...
      (microsoft.public.access.forms)
    • Re: Trouble displaying info from access db
      ... set Label Value ... not getting the Subject Code to display in the Label? ... Private Sub Form1_Load(ByVal sender As System.Object, ... Dim intRecordCount As Integer ...
      (microsoft.public.dotnet.languages.vb)