示例#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;
            }
        }
示例#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;
            }
        }
示例#3
0
 public static string GetLoginID()
 {
     return(BaseUtil.GetSessionValue(AdminInfo.LoginID.ToString()));
 }
示例#4
0
 public static int GetUserID()
 {
     return(Convert.ToInt32(BaseUtil.GetSessionValue(AdminInfo.UserID.ToString())));
 }