This is a migrated thread and some comments may be shown as answers.

[Solved] Ajax DataBinding and Authorization

1 Answer 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
James
Top achievements
Rank 1
James asked on 21 Mar 2012, 09:10 PM
Here's my dilemma.  I have an MVC Telerik grid on a page that requires authorization to access.  The grid uses Ajax databinding, and that is all working fine.  The problem is that if the user is authorized, but sits on the page for any reason and their session expires, when they come back and try to use the form, nothing happens.  The reason is because when the ajax request is made, it actually gets redirected to the login page (as all unauthorized requests should in this application), so the actual result is the HTML of the login page.

This, of course, throws an error which I can catch by subscribing to the OnError method.  But then I have to actually parse the responseText of the XMLHttpRequest object and determine if the content is actually my login page, and if it is, redirect.

But something tells me this can't be the first time this has happened.  Has anyone encountered this and if so, have you found a better workaround?  Am I missing something?  Thanks.

1 Answer, 1 is accepted

Sort by
0
Brett
Top achievements
Rank 1
answered on 25 Jul 2012, 10:04 PM
James, I am working through this delimma at this very moment. Actually I have been trying it for a week now.

I have tried ActionFilterAttributes but they are bypassed when the Authentication Session runs out. I have just now come to the same conclusion that you have in parsing out the html (result) in order to determine if the LogOn view is being returned.  This isn't exactly working for me at the moment and I can not think of anything more to try.  Did you get this to work successfully with something a little more elegant?
Tags
Grid
Asked by
James
Top achievements
Rank 1
Answers by
Brett
Top achievements
Rank 1
Share this question
or