public ActionResult Booking() { if (SessionUtility.GetBookingSession() == null || !SessionUtility.IsSessionAlive()) { return(RedirectToAction("Index", "Home")); } return(View()); }
public ActionResult Login(string msg, string callUrl) { if (SessionUtility.IsSessionAlive()) { return(RedirectToAction("Index", "Home")); } ViewData["msg"] = msg; ViewData["callUrl"] = callUrl; return(View()); }
public JsonResult AnyUserLogged() { var result = new JsonResult { ContentType = "text", Data = new { msg = "false" } }; if (SessionUtility.IsSessionAlive()) { result.Data = new { msg = "true" } } ; return(result); }
protected override bool AuthorizeCore(HttpContextBase httpContext) { var authorized = true; if (SessionUtility.IsSessionAlive()) //Only check authorize with user logged { if (string.IsNullOrEmpty(this.Roles) == false) { var roles = this.Roles.Split(' '); var currentUserRoles = SessionUtility.GetLoggedUser().AccountType.Roles; var rolesList = currentUserRoles.Split(' '); authorized = roles.Intersect(rolesList).Count() > 0; } } return(authorized); }
public void OnActionExecuting(ActionExecutingContext filterContext) { if (NeedToCheckSession(filterContext)) { if (SessionUtility.IsSessionAlive() == false) { string controllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName; string actionName = filterContext.ActionDescriptor.ActionName; var callBack = controllerName + "/" + actionName; filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary { { "action", "Login" }, { "controller", "Account" }, { "Area", "Admin" }, { "callUrl", callBack } }); } } }