I have been working on ASP.Net MVC3. I created view and controller. Also, I have a model to create account.
Controller:
[HttpPost]
public ActionResult LogOn(LogOnModel model, string returnUrl)
{
if (ModelState.IsValid)
{
----> if (model.UserName == "Guven" && model.Password == "12345")
{
FormsAuthentication.SetAuthCookie(model.UserName, false);
return RedirectToAction("Index", "Home");
}
else
{
ModelState.AddModelError("", "aaaaaaaaaaaaaaaaaa.");
}
}
return View(model);
}
I want to make from the database to control that the line marked on the above code.My question is:How can I do that controller?
If you’re using
MembershipProviderit has theValidateUserMethod.you’ll need to change your marked line to:
If your not using
MembershipProvideryet, you’ll might want to implement it.Have a look at: Sample Membership Provider Implementation