FilterContext.HttpContext.Response.Write ("<script>top.location.href = '/login/index ';</script>");
When using the time-out setting, you can return to the login page during native debugging, but not to the login page after the server deployment, the previous code is as follows:
public class Handlerloginattribute:authorizeattribute
{
public bool Ignore = true;
Public Handlerloginattribute (BOOL ignore = TRUE)
{
Ignore = Ignore;
}
public override void Onauthorization (AuthorizationContext filtercontext)
{
if (Ignore = = False)
{
Return
}
if (OperatorProvider.Provider.GetCurrent () = = null)
{
Webhelper.writecookie ("Schemedesign_login_error", "overdue");
FilterContext.HttpContext.Response.Write ("<script>top.location.href = '/login/index ';</script>");
Return
}
}
}
Puzzled for a long time, later saw the code of others on the internet somewhat different, replaced this code:
FilterContext.HttpContext.Response.Write ("<script>top.location.href = '/login/index ';</script>");
Replace with the following:
FilterContext.HttpContext.Response.Redirect ("/login/index");
After the test is feasible, the problem is solved, but do not know what is the reason, the first one did not succeed. Personal speculation is the cause of the environment, so after the use of the latter, can be executed jump.
ASP. NET MVC Cookie Timeout returns login page issue