您好 我在使用Ajax Call的Asp.net中遇到会话时间问题。 一旦会话超时,当一个控件调用异步时,这不是 重定向到登录页面。(我正在使用表单身份验证)
在同一页面中,如果我试图在会话过期时将(在Preinit中)重定向到登录页面.., 登录页面与上一页一起出现(因为ajax调用)。
请在会话超时和进行ajax调用时让我知道重定向到登录页面的方法。
答案 0 :(得分:0)
asp.net ajax有一个内置服务来帮助您进行身份验证授权
Sys.Services.AuthenticationService.logout(redirectUrl, logoutCompletedCallback, failedCallback, userContext);
要使用此服务,请将此添加到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