我在视图中有以下输入框,我想将它们传递给控制器:
<div>
<span><label>Username</label></span>
<span><input type="text" class="textbox" id="username"></span>
</div>
<div>
<span><label>Password</label></span>
<span><input type="password" class="password" id="password"></span>
</div>
这是我的控制器方法,用于验证特定用户身份:
public ActionResult LoginMethod(string username, string password)
{
if (username == "admin" && password == "admin1")
{
return RedirectToAction("Home");
}
else
{
return RedirectToAction("Login");
}
}