public ActionResult Login(FormCollection collection) { try { domain.User user = new domain.User(); user.Password = collection.Get("Password"); user.Email = collection.Get("Email"); user = appUser.LoginUser(user.Email, user.Password); Session["UserID"] = user.Id; //HttpContext.Cache.Insert("UserID", user.Id); return(RedirectToAction("Index", "Post")); } catch (Exception err) { return(View()); } }