示例#1
0
        public static bool IsAuthenticatedByRole(RoleUserDefinedEnum RoleId)
        {
            bool result = false;
            int  userId = 0;

            if (HttpContext.Current.User.Identity.IsAuthenticated && HttpContext.Current.User.Identity.AuthenticationType == "Forms")
            {
                userId = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                if (SessionWrapper.UserAccount != null)
                {
                    if (SessionWrapper.UserAccount.RoleId == RoleId.GetHashCode())
                    {
                        result = true;
                    }
                }
            }
            return(result);
        }
        public static bool IsAuthenticatedByRole(RoleUserDefinedEnum RoleId)
        {
            bool result = false;
            int userId = 0;

            if (HttpContext.Current.User.Identity.IsAuthenticated && HttpContext.Current.User.Identity.AuthenticationType == "Forms")
            {
                userId = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                if (SessionWrapper.UserAccount != null)
                {
                    if (SessionWrapper.UserAccount.RoleId == RoleId.GetHashCode())
                    {
                        result = true;
                    }

                }
            }
            return result;
        }