Ejemplo n.º 1
0
        public static void AuthenticateUser(ForumRespository db, int UserID)
        {
            string SessionID = Guid.NewGuid().ToString();

            HttpCookie SessionCookie = new HttpCookie("MvcForum", SessionID);
            SessionCookie.HttpOnly = true;
            SessionCookie.Expires = DateTime.Now.AddYears(50);
            HttpContext.Current.Response.Cookies.Add(SessionCookie);
            var SessionStore = new Forum_Session() { UserID = UserID, SessionGUID = SessionID };
            db.AddSessionToDB(SessionStore);
            db.Save();
        }