Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
685
How to detect authentication timeout in a grid ajax callback ?
posted

Here is the situation.
I'm using Forms authentication mode.
I have a webform with a WebDataGrid which has Sorting bahavior enabled.
I let the authentication timeout expire, then click on a column header to sort.
The problem is that the AJAX wait indicator is displayed forever and nothing happens.
Also, the grid client event AJAXResponse is never fired.
How can I trap an authentication timeout and redirect the user to the login page ?

I *think* I did manage to detect the timeout in Global.asax using this code

 

protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
  if (!Request.IsAuthenticated &&
      null != Request.Headers["Cookie"] &&
      Request.Headers["Cookie"].IndexOf(FormsAuthentication.FormsCookieName) >= 0 &&
      Request.Path != FormsAuthentication.LoginUrl)
  {
    // detect if it's an infragistics ajax callback
    if (Request.Form.AllKeys.Any(x => x.StartsWith("__IGCallback")))
    {
      // now what ??
    }
    // redirect to login
    else
      LoginManager.RedirectToLogin(LoginManager.ReasonType.Expired);
  }
}



But then what do I need to do to inform the client grid that a timeout occured ?

 

 

  • 19693
    posted

    Hello canam ,

    I tried to reproduce the described issue but I was not able to.

    Do you set DataSouce on every page load of the grid?

    Have you set the EnableAjax property to true?

    Have you set EnableDataViewState = true ?

    Another option is to handle the ColumnSorting client event of the WebDataGrid and doPostBack to the server

           <ig:Sorting>

                        <SortingClientEvents ColumnSorting="WebDataGrid1_Sorting_ColumnSorting" />

                    </ig:Sorting>

    Let me know if you need further assistance.