protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
             if (Request.Cookies["manage"] == null)
                {  
            //重置路由吧算是 filterContext.Result
= RedirectToRoute("default", new { Controller = "Land", Action = "Index" });          } base.OnActionExecuting(filterContext); }

 

在网上看到其他的解决方案:

filterContext.HttpContext.Response.Redirect("")
//只需要加上
filterContext.Result = new HttpUnauthorizedResult()
//或者
filterContext.Result = new EmptyResult()
//filter验证不通过就不会执行action了,

 

相关文章:

  • 2021-06-13
  • 2021-05-20
  • 2021-09-24
  • 2022-12-23
  • 2021-05-19
  • 2022-01-26
  • 2021-10-18
  • 2021-11-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2021-10-26
  • 2021-06-02
相关资源
相似解决方案