Пример #1
0
        public void OnAuthentication(AuthenticationContext filterContext)
        {
            authenticated = false;

            //uncomment to prevent caching
            //HttpContext.Current.Response.AddHeader("Cache-Control", "no-cache, no-store, must-revalidate");
            //HttpContext.Current.Response.AddHeader("Pragma", "no-cache");
            //HttpContext.Current.Response.AddHeader("Expires", "0");

            ILoginService loginService = new LoginService();

            if (HttpContext.Current.Session.Count > 0)
            {
                if (loginService.AuthenticateSession(
                        HttpContext.Current.Session["username"].ToString(),
                        HttpContext.Current.Session.SessionID))
                {
                    Debug.WriteLine("\n[Authentication Filter :\tSUCCESS!]\n");
                    authenticated = true;
                }
            }
        }