Serializing Request.Form to a Dictionary or something

Posted by André Alçada Padez on Stack Overflow See other posts from Stack Overflow or by André Alçada Padez
Published on 2011-01-07T01:00:14Z Indexed on 2011/01/07 11:54 UTC
Read the original article Hit count: 223

Filed under:
|
|

Hi i need to pass my Request.Form as a parameter, but first i have to add some key/value pairs to it. I get the exception that the Collection is readonly.

I've tried:

System.Collections.Specialized.NameValueCollection myform = Request.Form; 

and i get the same error.

and i've tried:

foreach(KeyValuePair<string, string> pair in Request.Form)
{
     Response.Write(Convert.ToString(pair.Key) + " - " + Convert.ToString(pair.Value) + "<br />");
}

to test if i can pass it one by one to another dictionary, but i get:

System.InvalidCastException: Specified cast is not valid.

some help, anyone? Thanx

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET