zoukankan      html  css  js  c++  java
  • Filter进行session验证

    解决方法:先创建一个新的控制器  随变命名  adminFilterConter   让他继承自controller控制器  在里面写方法

    在执行方法之前授限执行  

    protected override void OnActionExecuting(ActionExecutingContext filterContext)

            {

                if (Session["UserInfo"] == null)

                {

                    Response.Redirect("/UserLogin/Index");

                }

                //base.OnActionExecuting(filterContext);

            }

     

    再让需要被验证的controller继承自此控制器  即可进行验证  

       public class HomeController : AdminBaseController

        {

            //

            // GET: /Home/

     

            public ActionResult Index()

            {

                return View();

            }

     

        }

  • 相关阅读:
    live-server
    vue-插槽
    100%的背影
    Luogu P3243 菜肴制作
    CF512E Fox And Polygon
    BZOJ2523/LOJ2646 聪明的学生
    Luogu P3959 宝藏
    Luogu P2280 激光炸弹
    ACAG 0x02-8 非递归实现组合型枚举
    ACAG 0x02-4 费解的开关
  • 原文地址:https://www.cnblogs.com/lierjie/p/3833941.html
Copyright © 2011-2022 走看看