1:MVC后台接收不到表单提交的数据
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>login test</title>
</head>
<body>
<div id="form-div">
<form id="form1" action="login" method="post">
<p>用:<input name="userName[1]" type="text"/></p>
<p>密:<input name="userName[3]" type="text"/></p>
<p><input type="submit" value="登录"></p>
</form>
</div>
</body>
</html>
后台接收
public ActionResult login(string[] userName)
{
}
不能这么写
<p>用户名:<input name="username" type="text" id="username" tabindex="1" size="15" value=""/></p>
<p>密 码:<input name="password" type="text" id="password" tabindex="2" size="16" value=""/></p>
public ActionResult login(FormCollection fc)
{
string username = fc["username"];
string pass = fc["password"];
}