[英]Unable to return to login page after session expires in mvc4
我创建了过滤器来检查会话,如果会话已过期,我将重定向到登录页面。 这是我的下面的代码。
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
HttpContext ctx = HttpContext.Current;
if(HttpContext.Current.User.Identity.Name=="")
{
FormsAuthentication.SignOut();
filterContext.Result = new RedirectResult("~/Login/Index");
return;
}
base.OnActionExecuting(filterContext);
}
我将动作方法装饰如下。
[SessionTimeOut]
public PartialViewResult GetGridData(string client_id, string emp_id, string empciti_id, string Message)
工作正常。 会话过期后,它将呈现登录页面。 但是我面临的问题是我的布局页面仍然出现在顶部。 在中心出现我的登录页面。 所以我该如何解决这个问题? 提前致谢。
在〜/ Views / Login / Index.cshtml设置中-
Layout = null;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.