Hi I am having problem in session time out in Asp.net with Ajax Call. Once the session times out,when a control calls asynchrous this is not redirecting to login page.(I am using forms Authentication)
开发者_如何学GoIn the same page if i try to redirect(in Preinit) to login page if session expired.., the login page appears with the previous page(because of the ajax call).
Please let me know the way to redirect to the login page when the session time out and when a ajax call is made.
asp.net ajax have a built in services to help you with authentication authorization
Sys.Services.AuthenticationService.logout(redirectUrl, logoutCompletedCallback, failedCallback, userContext);
To use this service add this to web.config
<system.web.extensions>
<scripting>
<webServices>
<authenticationService enabled="true" />
</webServices>
</scripting>
</system.web.extensions>
http://www.asp.net/ajaxlibrary/Reference.Sys-Services-AuthenticationService-logout-Method.ashx
http://www.asp.net/ajax/tutorials/understanding-asp-net-ajax-authentication-and-profile-application-services
精彩评论