how to use Session in MVC4
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Login(Login login)
{
if (ModelState.IsValid)
{
var loginOrigin =
db.Logins.FirstOrDefault(s => s.UserName == login.UserName && s.Password == login.Password);
if (loginOrigin != null)
{
SessionValues.Current.Login = new LoginInSession
{
LoginId = loginOrigin.LoginId,
Password = loginOrigin.Password,
UserName = loginOrigin.UserName,
};
return RedirectToAction("CreateDocuments", "Home");
}
//ViewBag.message = "Invalid Username Or Password";
//return View("Login");
}
//ModelState.Clear();
return RedirectToAction("Login");
//return View();
}