コード例 #1
0
        public override void OnAuthorization(HttpActionContext actionContext)
        {
            AuthentificationService authentificationService = new AuthentificationService(actionContext);

            if (!authentificationService.IsAuthorized())
            {
                base.OnAuthorization(actionContext);
            }
            else
            {
                return;
            }
        }
コード例 #2
0
        public void OnAuthorization(AuthorizationContext filterContext)
        {
            AuthentificationService authentificationService = new AuthentificationService(filterContext);

            if (!authentificationService.IsAuthorized())
            {
                var urlHelper = new UrlHelper(filterContext.RequestContext);
                filterContext.Result = new RedirectResult(urlHelper.Action("Logon", "Home"));
            }
            else
            {
                return;
            }
        }