Encrypt() static private method

static private Encrypt ( string plainText ) : string
plainText string
return string
Ejemplo n.º 1
0
        /// <summary>
        /// Sets the basic auth cookie.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="expires">The expires.</param>
        internal static void SetBasicAuthCookie(string value, int expires)
        {
            string cookieName = BasicAuthenticationHelper.CookieName;

            if (!string.IsNullOrEmpty(cookieName))
            {
                HttpCookie cookie = HttpContext.Current.Request.Cookies[cookieName] ?? new HttpCookie(cookieName);
                cookie.Value   = AuthenticationEncryption.Encrypt(value);
                cookie.Expires = DateTime.Now.AddMinutes(expires);
                HttpContext.Current.Response.Cookies.Add(cookie);
            }
        }