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?
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?
FormCollection uses POST values and not what's in the query string. Your action should look:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Login(FormCollection formCollection)
{
...
}
This is just a comment (I'm not allowed to post comments) to the above question within the comments, "how would this be done using http get"? I realize purists would say you're doing something wrong if you're using the form collection in a get (or maybe if you're using it at), but I simply don't agree; I'm using a get because I'm getting a FileResult, I'm not binding to my model object (for various reasons), and I can't separate my form fields into params because it includes a multi-select list. Thus, I'm just loading the collection myself:
var realCollection = new FormCollection( Request.QueryString );