public static Entities.LoggedInAccount SetStudent(HttpContext context, Entities.Student student, bool fullProcess = false) { var account = new Entities.LoggedInAccount { Id = student.Id, UserName = student.Email, accountType = Entities.eAccountType.Student }; context.Response.Cookies.Add(new HttpCookie(KEY_STUDENT, account.CookieValue) { Expires = DateTime.Now.AddDays(7), Secure = true, }); context.Session[KEY_STUDENT] = account; if (fullProcess) { // no multiple connections allowed // clear all connected sessions and add only the current one ConnectedSessionsSingleTon.Instance.MarkAllToRemove(student.Id); ConnectedSessionsSingleTon.Instance.Add(new ConnectedSession { StudentId = student.Id, Session = context.Session }); } return(account); }
public static void SetAccount(HttpContext Context, Entities.LoggedInAccount Account) { Context.Response.Cookies.Add(new HttpCookie(KEY_ACCOUNT, JsonConvert.SerializeObject(Account)) { Expires = DateTime.Now.AddDays(60), Secure = true, }); }
public static void SetAccount(HttpContext Context, Entities.LoggedInAccount Account) { Context.Session[KEY_ACCOUNT] = Account; }