Given the following markup:
<form method="post" action="/home/index">
Username:
<%= Html.TextBox("UserName")%>
Password:
<%= Html.TextBox("Password")%>
<input id="login" type="button" value="Login" />
<input id="Submit1" type="submit" value="submit" />
</form>
Can you tell me why the model binding is not working when invoking my action:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Index(string UserName, string Password)
{
//UserName and Password are null! Why?
}
Edit: The form values are getting posted. If I inspect the Request.Form property, I see that the correct values are being posted.
? Request.Form {UserName=sdf&Password=sdf} [System.Web.HttpValueCollection]: {UserName=sdf&Password=sdf} base {System.Collections.Specialized.NameObjectCollectionBase}: {UserName=sdf&Password=sdf} AllKeys: {string[2]}