I write ASP.NET MVC application and I found out for me an interesting thing. When I use in View:
@using (Html.BeginForm("Login", "Home", FormMethod.Post))
a method Login of class HomeController is called. But if I write this html into View:
<form action="@Url.Action("Login", "Home")" method="post">
(form action is leading to the same action of the same controller) it is Index action called instead. Why?
In both cases the same html below is rendered:
<form action="/Home/Login" method="post">
Thanks
Well, may be for others – I’ve bought a html template, not for a small money, but the problem was, the button was out of the form tag. So Index action was executed instead.