public override void OnActionExecuting(ActionExecutingContext filterContext) { var tokenCookie = filterContext.HttpContext.Request .Cookies[LoginDbTool.CookieName]; if (tokenCookie == null) { this.setError(filterContext); } else { using (var db = new E7pnnContext()) { var service = new LoginDbTool(db); var acc = service.checkToken(tokenCookie.Value); if (string.IsNullOrEmpty(acc)) { this.setError(filterContext); } } } base.OnActionExecuting(filterContext); }
public LonigController() { var Db = new E7pnnContext(); this.Server = new LoginDbTool(Db); this.UserTb = new UserTbDbTool(Db); }