Apr 21, 2011, 1:32 PM
[CLOSED] Handling Un-Authenticated Ajax calls [401 Error]
hi,
I'm using forms Authentication with heavy use of Json Asmx webservices and Static DirectMethods. if the user session expired and static directMethod invoked by user action the system redirect him to login page. but if the request done through Asmx webmethod the nice error window shows:
Status Code: 401
Status Text: Unauthorized
{"Message":"Authentication failed.","StackTrace":null,"ExceptionType":"System .InvalidOperationException"}
so the directMethod handle the problem correctly by redirecting the user.. now all WHAT i want is to make all ajax calls behave the same way [perform redirection] when the user session expire!
it's clear that no code sample is needed because the solution already handled in some part in ext.net but i couldn't figure it out + i'm using MySQL custom provider and custom security tables so full project need to be posted....just i can't do that [i need like 10 hours to prepare that!!!]
so again in other words: how-to-manage-a-redirect-request-after-a-ajax-call [i.e, store reload/load through asmx],
refs:
http://stackoverflow.com/questions/1...uery-ajax-call
http://stackoverflow.com/questions/6...n-an-ajax-call
in the above refs they adviced to do window.location... but i think the way ext.net doing is better because in this post:
http://forums.ext.net/showthread.php...Authentication
vladimir said
so please help me ASAP!
I'm using forms Authentication with heavy use of Json Asmx webservices and Static DirectMethods. if the user session expired and static directMethod invoked by user action the system redirect him to login page. but if the request done through Asmx webmethod the nice error window shows:
Status Code: 401
Status Text: Unauthorized
{"Message":"Authentication failed.","StackTrace":null,"ExceptionType":"System .InvalidOperationException"}
so the directMethod handle the problem correctly by redirecting the user.. now all WHAT i want is to make all ajax calls behave the same way [perform redirection] when the user session expire!
it's clear that no code sample is needed because the solution already handled in some part in ext.net but i couldn't figure it out + i'm using MySQL custom provider and custom security tables so full project need to be posted....just i can't do that [i need like 10 hours to prepare that!!!]
so again in other words: how-to-manage-a-redirect-request-after-a-ajax-call [i.e, store reload/load through asmx],
refs:
http://stackoverflow.com/questions/1...uery-ajax-call
http://stackoverflow.com/questions/6...n-an-ajax-call
in the above refs they adviced to do window.location... but i think the way ext.net doing is better because in this post:
http://forums.ext.net/showthread.php...Authentication
vladimir said
Redirect is generated by ASP.NET, we just convert it to script for correct handling by DirectEvent client side class
Last edited by Daniil; May 02, 2011 at 10:30 AM.
Reason: [CLOSED]