使用 asp .net mvc,我使用 post 和 get 提交表单。在我的控制器中,我只能访问 post 参数,但不能访问 GET 参数。
这是我的 HTML 表单:
<form name="input" action="/account/Login/?test=123" method="post">
Username: <input type="text" name="username">
Lastname: <input type="text" name="lastname">
Password: <input type="text" name="password">
<input type="submit" value="Submit">
</form>
我的控制器:
[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
public ActionResult Login(User model)
{
string test = Request.QueryString["test"]; // this is null
}
我也为我的控制器尝试过这个,但无济于事......
[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
public ActionResult Login(User model, string test)
{
// but "test" is also null
}