[英]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.