나는 ASP.NET MVC4와 함께 프로젝트를 진행하고 있으며 다른 페이지에서 ID, 이름 등의 현재 사용자 정보를 사용하여 로그인해야합니다.인증 + 세션 사용자 ASP.NET 유지하기
[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");
}
나는 세션 코드가 필요하다고 생각합니다. 아무도 도와 줄 수 없습니까? ??
빈 프로젝트와 함께 제공된 계정 컨트롤러에서 생성 된 코드가 어떻게 수행되었는지 확인할 수 있습니다. 그것은'FormsAuthentication' 클래스를 사용합니다. – codingbiz