private string[] GetRolesFromCookie()
        {
            string[]     currentUserRoles = new string[0];
            String       hostName         = WebUtils.GetHostName();
            SiteSettings siteSettings     = CacheHelper.GetCurrentSiteSettings();

            if (siteSettings != null)
            {
                string     roleCookieName = SiteUtils.GetRoleCookieName(siteSettings);
                ArrayList  userRoles      = new ArrayList();
                HttpCookie roleCookie     = HttpContext.Current.Request.Cookies[roleCookieName];
                if (roleCookie != null)
                {
                    FormsAuthenticationTicket ticket
                        = FormsAuthentication.Decrypt(roleCookie.Value);

                    if (null == ticket || ticket.Expired)
                    {
                        return(GetRolesAndSetCookieInternal());
                    }

                    string roles = ticket.UserData;

                    if (WebConfigSettings.PreEncryptRolesForCookie)
                    {
                        try
                        {
                            roles = SiteUtils.Decrypt(roles);
                        }
                        catch (System.Security.Cryptography.CryptographicException)
                        { }
                        catch (FormatException)
                        {
                        }
                    }

                    foreach (string role in roles.Split(new char[] { ';' }))
                    {
                        userRoles.Add(role);
                    }
                }

                currentUserRoles = (string[])userRoles.ToArray(typeof(string));
            }



            return(currentUserRoles);
        }