Example #1
0
    public HttpCookie CreateAuthCookie(string username, string salt)
    {
        // Create the cookie and set its value to the username and a hash of the
        // password and salt. Use a pipe character as a delimiter so we can
        // separate these two elements later.
        //
        Guid       guid   = Guid.NewGuid();;
        HttpCookie cookie = new HttpCookie("UserSzukaj");

        if (Usr.SaveTokenToDb(guid.ToString().ToUpper(), username))
        {
            cookie.Value   = username + "|" + CreateHash(guid.ToString().ToUpper(), salt);
            cookie.Expires = DateTime.Now.AddDays(1);
        }
        return(cookie);
    }