问题
i am posting a simple action.
public void Login(FormCollection formCollection)
{
...
}
Even with few querystring values, the formcollection.Count
is 0. Is it by behaviour?
回答1:
FormCollection uses POST values and not what's in the query string. Your action should look:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Login(FormCollection formCollection)
{
...
}
来源:https://stackoverflow.com/questions/2265194/should-formcollection-be-empty-on-asp-net-mvc-get-request