In my LoginController I have the following action method:
[HttpPost]
public ActionResult Login(LoginViewModel model, string returnUrl) {
if (ModelState.IsValid) {
if (authProvider.Authenticate(model.UserName, model.Password)) {
return Redirect(returnUrl ?? Url.Action("Index", "Admin"));
} else {
ModelState.AddModelError("", "Incorrect username or password");
return View();
}
} else {
return View();
}
}
And the corresponding view is strongly typed with LoginViewModel (also the first argument to the above action method) class and this is how the action method is called:
@using(Html.BeginForm()) {
@Html.EditorForModel()
<p><input type="submit" value="Log in" /></p>
}
Now I have 2 questions:
1.There is another action method with the same name in the controller. The difference is the other one doesn't have [HttpPost] attribute. Why is the above action method called but not the other one?
2.Both arguments of the action method are different from null. What information is passed to the invoked action method. Can it be inferred that model and the url is passed to the method? If so, then in what circumstances are these two prameters passed and when they are not?