I´m new in MVC with Razor... I´m trying to do a login page, so i have this code in my cshtml:
Código ASP:
Ver original@using (Html.BeginForm("LogOn", "Login", FormMethod.Post))
{
@Html.LabelFor(m => m.usuario)
@Html.TextBoxFor(m => m.usuario)
@Html.LabelFor(m => m.password)
@Html.PasswordFor(m => m.password)
@Html.LabelFor(m => m.rememberMe)
@Html.CheckBoxFor(m => m.rememberMe)
<input type="submit" value="Iniciar sesión" />
}
In the controller i have this:
Código ASP:
Ver originalpublic class LoginController : Controller
{
public ActionResult Login()
{
return View();
}
[HttpPost]
public ActionResult LogOn(Login lg)
{
if(//valido mi usuario)
{
return RedirectToAction("MyContent", "MyContent");
}
return View("Login");
}
}
But it never called the action "LogOn" it only called the action default "Login" and i don´t know which is the error...
Pleas help me!!!
Thanks!