Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

should formcollection be empty on asp.net mvc GET request

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?

like image 363
Adeel Avatar asked Feb 15 '10 10:02

Adeel


1 Answers

FormCollection uses POST values and not what's in the query string. Your action should look:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Login(FormCollection formCollection)
{
   ...
}
like image 182
Darin Dimitrov Avatar answered Sep 30 '22 05:09

Darin Dimitrov