我有一个使用 ASP.NET MVC4 的项目,我必须登录并保留当前用户信息,如 id、他的姓名等,以便在其他页面中使用它们
[HttpPost]
public ActionResult Auth(string login, string password)
{
// Customer c = null;
Customer cus = (from e in db.Customers where e.Login == login && e.Password == password select e).SingleOrDefault();
if (cus != null)
{
//String s = User.Identity.Name;
return RedirectToAction("Index");
}
else return RedirectToAction("Error");
}
我想我只需要会话代码,所以请任何人都可以帮助我??