Example #1
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            if (!SesionHelper.ExistUserEnSesion())
            {
                filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new
                {
                    controller = "Login",
                    action     = "Index"
                }));
            }
            else
            {
                if (HttpContext.Current.Session["nombre"] == null)
                {
                    SesionHelper.DestroyUserSession();
                    filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new
                    {
                        controller = "Login",
                        action     = "Index"
                    }));
                }
            }
        }
 public ActionResult Logout()
 {
     SesionHelper.DestroyUserSession();
     return(Redirect("~/"));
 }