public void SessionIDIs32CharsLong() { for (var i = 0; i < 1000; i++) { var session = new UserSession(null, null, DateTime.UtcNow); Assert.AreEqual(session.SessionID.Length, 32); } }
internal static HttpCookie GetAuthCookie(UserSession session, bool persist) { if (persist) { HttpCookie authCookie; var time = TimeSpan.FromDays(3652.5); var ticket = new FormsAuthenticationTicket (session.SessionID, true, Convert.ToInt32(time.TotalMinutes)); var encryptedTicket = FormsAuthentication.Encrypt(ticket); authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); authCookie.Expires = DateTime.Now.Add(time); return authCookie; } else { return FormsAuthentication.GetAuthCookie(session.SessionID, false); } }