////Login.cshtml
<form
[email protected]("~/account/login") method="post">
<input id="inputName" type="text" />
<input id="inputPassword" type="password" />
<input id="submit" type="submit" value="Login" />
</form>
////AccountController.cs
public ActionResult Login(string inputName,string inputPassword)
{
string is_error = null;
if (inputName=="yoyo"&&inputPassword=="123456")
{
RedirectToAction("~/home/index");
}
is_error = "用户名或者密码错误!请再试一次。";
ViewBag.isError = is_error;
return View();
}
提交后页面能跳转,但是参数传值失败,inputName和inputPassword为null 难道一定要用BeginForm的方式创建form或者只能用ajax提交么。。。求大神们解答,万分感谢。