Example #1
0
        public string Get(string key)
        {
            string value = GetValue(key);

            if (value != null)
            {
                return(CryptographyHelper.Decrypt(value));
            }

            return(null);
        }
Example #2
0
 public void GetUserDataFromRememberMeCookie(ref string userName, ref string password)
 {
     if (_request != null)
     {
         HttpCookie userDataCookie = _request.Cookies.Get(Constants.CommonConstants.RememberMeCookieName);
         if (userDataCookie != null)
         {
             string userData = userDataCookie.Value;
             if (!string.IsNullOrEmpty(userData))
             {
                 userData = CryptographyHelper.Decrypt(userData);
                 string[] values = userData.Split(',').ToArray();
                 if (values != null && values.Length >= 2)
                 {
                     userName = values[0];
                     password = values[1];
                 }
             }
         }
     }
 }
Example #3
0
 public string GetUserDataFromLoginCookie()
 {
     if (_response != null)
     {
         if (HttpContext.Current.User != null)
         {
             if (HttpContext.Current.User.Identity.IsAuthenticated)
             {
                 if (HttpContext.Current.User.Identity is FormsIdentity)
                 {
                     FormsIdentity             formIdentity   = (FormsIdentity)HttpContext.Current.User.Identity;
                     FormsAuthenticationTicket userAuthTicket = formIdentity.Ticket;
                     if (!string.IsNullOrEmpty(userAuthTicket.UserData))
                     {
                         return(CryptographyHelper.Decrypt(userAuthTicket.UserData));
                     }
                 }
             }
         }
     }
     return(string.Empty);
 }