AJAX Exception after user session timeout

Dec 7, 2012 at 10:08 AM

Hi,

We have noticed that when a user has a period of inactivity and their session times out, when they click a link/action/try to do something they are presented with a modal popup and an error like this:

"AJAX Error

Error in: /SomeRepository/Action/GetAllClaims?id=Namespace.SomeRepository%3B1%3BSystem.Int32%3B0%3BFalse%3B%3B0 error:""

If the user refreshes the page, they are redirected to the login page. Once they login, they can continue without any problems.

I'm wondering if this is a limitation with the the AJAX architecture whereby it is not possible to redirect the page to a URL from an AJAX request?

Thanks

John

Coordinator
Dec 7, 2012 at 2:36 PM

I have logged this as an issue for us to look into John.  At  minimum we should be returning a friendly message saying e.g. "Session Timed out, please hit Refresh" or similar. 

Dec 7, 2012 at 2:43 PM

Hi Richard,

Thanks for that - I think this would be enough for the users to understand what has happened and what they need to do.

John

Coordinator
Jan 4, 2013 at 3:35 PM

Fixed in next build but note caveat

Handle case where we get back a login page from an ajax call. Trigger a refresh to get a full login page.

Note this relies on recognising the login page - currently that's done on "section#loginForm" - custom login pages either need that or should change "handleLoginForm" in NakedObjects-Ajax.js

Jan 29, 2013 at 9:47 AM

Hi Stef,

I've just upgraded to NOF 5.1 and I can see the changes that have been made in NakedObjects-Ajax.js.

I've added a section with an Id of "loginForm" to the Login page but the page refresh isn't working. We are using WIF so it is the WifAccount which is being redirected to (via HTTP 302). 

I set a breakpoint within handleLoginForm but it is not being hit after the session has timed out. Is there something different with using WIF which would make this not work?

Thanks,

John

Mar 22, 2013 at 10:33 AM
Any suggestions as to how to fix this?

Thanks
John
Coordinator
Mar 22, 2013 at 12:17 PM
I think this will need a bit more tracing through to see exactly what is happening.

I would have expected the 302 from WIF to be handled by the browser such that what arrives back after the ajax call is the WIF login page.
Which you could then id and reload in handleLoginForm.

But if you never arrive in handleLoginForm that suggests that is not how the 302 is being handled. So I'm afraid it's a matter of working back from the error to find the best place to add something similar to 'handleLoginForm' for the WIF case.

It maybe appropriate to add some ajax error handling code where you can detect this particular error, notify the user and reload the page.