I have an ASP.NET MVC page, using entityframework, and I have a login system:
public ActionResult Index(LoginModel model)
{
if (ModelState.IsValid)
{
try
{
if (Membership.ValidateUser(model.Email, model.Senha))
{
Pessoa pessoa = this.PessoaServico.GetMany(p => p.Email == model.Email).First();
if (pessoa is Lojista)
return RedirectToAction("Index", "Dashboard", new { area = "Lojista" });
}
}
catch (Exception e)
{
ModelState.AddModelError("erro", "Ocorreu um erro inesperado");
}
}
ModelState.AddModelError("erro", "Usuário e/ou Senha Inválidos.");
return View(model);
}
I only authorize who is logged in with the following description [Authorize(Roles = "Lojista")]
the login part of the system was not me that did, so I have a bit of difficulty to understand the operation, and when I look for something about I can not understand very well .
I saw some things stick in web.config, but I could not figure it out. If you need more information, just say it.