public ActionResult Loggin(string Name, string Password)
 {
     GeneralUser user = new GeneralUser();
     user.Authenticate();
     LoggedinPersonsCache.Current.AddNewPerson(user);
     Response.Cookies.Add(FormsAuthentication.GetAuthCookie(user.Token.ToString(), false));
     return RedirectToAction("Index", "TestAuthorized");
 }
 public ActionResult SetGeneralUser()
 {
     GeneralUser user = new GeneralUser
     {
         Identity = (User as GeneralUser).Identity,
         Token = (User as GeneralUser).Token
     };
     LoggedinPersonsCache.Current.UpdatePerson(user);
     return RedirectToAction("Index");
 }
 public bool UpdatePerson(GeneralUser user)
 {
     Remove(user.Token.ToString());
     AddSlidingKey(user.Token.ToString(), user, 2);
     return true;
 }
 public bool RemovePerson(GeneralUser user)
 {
     if (user == null || user.Token == null || !Exists(user.Token.ToString())) return false;
     Remove(user.Token.ToString());
     return true;
 }
 public bool AddNewPerson(GeneralUser user)
 {
     AddSlidingKey(user.Token.ToString(), user, 2);
     return true;
 }