views:

178

answers:

1

Most of the actions in my controller have statically-defined parameter lists and so they correspond nicely with the standard tutorial examples:

public ActionResult SomeAction(string id, string arg1, string arg2)
{
    // use arg1, arg2...
}

But I have one troublesome case where the view puts together a form dynamically, so the set of parameters is completely dynamic. I'd be happy with a mapping of string names to string values.

I've tried this:

public ActionResult TroublesomeAction(string id, IDictionary<string, string> args)
{
    // loop through args...
}

But args is passed a null. What's the easiest way in an action to get hold of the famous "parameter dictionary" that we hear so much about in error messages these days?

And if there isn't an easy way, how would I do it the hard way?

A: 

From a controller, we have access to this:

Request.Form

Which contains exactly what I need, so no need to map to an argument on the action.

Daniel Earwicker
Glad you found the cheese in my previous comment. :)
Chad Ruppert
I didn't! I used the words "form" and "dictionary" in my question, so if you were dropping a hint I totally missed it. What I needed to know was "the base class has a bunch of members..."
Daniel Earwicker