[CLOSED] Treat connection error

  1. #1

    [CLOSED] Treat connection error

    Is there any way to treat connection errors so that i can, for example, redirect the user to login screen and show a treated message saying there was a connection problem? I mean, user loses connection to the internet and does something that calls a directmethod. An untreated exception is shown. How to trat this?

    Is there a way to do it globally for all directmethods in application?
    Last edited by Daniil; Jun 24, 2014 at 3:16 PM. Reason: [CLOSED]
  2. #2
    Hi @josegarcia,

    This should work.
    <ext:ResourceManager runat="server">
        <Listeners>
            <AjaxRequestException Handler="..." />
        </Listeners>
    </ext:ResourceManager>
  3. #3
    It kinda worked, but sometimes the window with the untreated message is still shown (Request failure):

    Click image for larger version. 

Name:	help.png 
Views:	57 
Size:	15.6 KB 
ID:	12721

    How to hide that?
  4. #4
    If you don't want a default failure window to be appeared, please return false from an AjaxRequestException listener or set a ResourceManager's ShowWarningOnAjaxFailure to false.
  5. #5
    One more thing... Sometimes the icon is not shown when i show a custom message on connection error, like:

                var function = String.Format(
                    "Ext.Msg.show({{ title: '{1}', msg: '{0}', icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK }}); return false;"
                    , ViewConfigurationServiceResource.ProblemaDeConexaoMensagem, ViewConfigurationServiceResource.ProblemaDeConexaoTitulo
                    );
                ResourceManager.GetInstance(HttpContext.Current).ShowWarningOnAjaxFailure = false;
    
                ResourceManager.GetInstance(HttpContext.Current).Listeners.AjaxRequestException.Handler += function;
    Click image for larger version. 

Name:	help2.png 
Views:	71 
Size:	6.8 KB 
ID:	12731

    I guess it's because the connection is down, so the icon can't be loaded, right? Is there a way to preload the icon?
  6. #6
    Quote Originally Posted by josegarcia View Post
    I guess it's because the connection is down, so the icon can't be loaded, right?
    Hard to say.a


    Quote Originally Posted by josegarcia View Post
    Is there a way to preload the icon?
    You can run this JavaScript code.
    new Image().src = "image url";
  7. #7
    And what is the "image url" for Ext.MessageBox.ERROR?
  8. #8
    Then that icon appears, inspect HTML elements using a browser's developer tools. You should be able to see the URL.

Similar Threads

  1. [CLOSED] Handle lost internet connection
    By blueworld in forum 2.x Premium Help
    Replies: 7
    Last Post: Jan 30, 2014, 4:03 AM
  2. [CLOSED] connection speed meter
    By JCarlosF in forum 2.x Premium Help
    Replies: 2
    Last Post: Sep 02, 2013, 5:03 PM
  3. Replies: 0
    Last Post: Feb 03, 2013, 2:40 AM
  4. Ext.Net and slow connection
    By threewonders in forum 1.x Help
    Replies: 1
    Last Post: May 17, 2012, 6:43 PM
  5. Replies: 3
    Last Post: Sep 08, 2011, 6:38 AM

Posting Permissions