Ejemplo n.º 1
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            String ControllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName.ToUpper();
            String ActionName     = filterContext.ActionDescriptor.ActionName.ToUpper();
            String Action         = string.Format("{0}Controller{1}", ControllerName, ActionName).ToUpper();

            //-----Check Authorization ---------

            if (BaseUtil.ListControllerExcluded().Contains(ControllerName))
            {
                if (ControllerName == "USERREGISTRATION" && (ActionName == "CREATE" || ActionName == "LOGIN" || ActionName == "LOGOUT"))
                {
                    return;
                }
            }
            else
            {
                if (BaseUtil.GetSessionValue(AdminInfo.UserID.ToString()) == "")
                {
                    filterContext.Result = null;
                    filterContext.Result = new RedirectResult("/UserRegistration/login");
                    return;
                }
                if (!BaseUtil.CheckAuthentication(filterContext))
                {
                    filterContext.Result = null;
                    filterContext.Result = new RedirectResult("/Home/AccessDenied");
                    return;
                }

                return;
            }
        }
Ejemplo n.º 2
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            String ControllerName = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName.ToUpper();
            String ActionName     = filterContext.ActionDescriptor.ActionName.ToUpper();
            String Action         = string.Format("{0}Controller{1}", ControllerName, ActionName).ToUpper();

            //-----Check Authorization ---------

            if (BaseUtil.ListControllerExcluded().Contains(ControllerName))
            {
                if ((ControllerName == "PROFILE" && (ActionName == "SELECTTEST" || ActionName == "SUBMITSELECTTEST" || ActionName == "REFERENCECHECK" || ActionName == "SELECTMEET" || ActionName == "BOOKMEET")) || (ControllerName == "EMPLOYER" && ActionName == "SUBMITINTEREST") || (ControllerName == "JOBDETAILS" && (ActionName == "LOADMOREJOBS" || ActionName == "JOBVIEW" || ActionName == "SHAREWF" || ActionName == "SELECT_FILLSKILLS") || ControllerName == "ACCOUNT" || ControllerName == "HOME"))
                {
                    return;
                }
                if (BaseUtil.GetSessionValue(AdminInfo.UserID.ToString()) == "")
                {
                    filterContext.Result = null;
                    filterContext.Result = new RedirectResult("/Account/login");
                    return;
                }
                if (!BaseUtil.CheckAuthentication(filterContext))
                {
                    filterContext.Result = null;
                    filterContext.Result = new RedirectResult("/Home/AccessDenied");
                    return;
                }

                return;
            }
            else
            {
                if (BaseUtil.GetSessionValue(AdminInfo.UserID.ToString()) == "")
                {
                    filterContext.Result = null;
                    filterContext.Result = new RedirectResult("/Account/login");
                    return;
                }
                if (!BaseUtil.CheckAuthentication(filterContext))
                {
                    filterContext.Result = null;
                    filterContext.Result = new RedirectResult("/Home/AccessDenied");
                    return;
                }

                return;
            }
        }