I am dynamicaly generating a HTML form that is being submitted to a .aspx webpage. How do I determine in the resulting page what variable names were submitted and what the value
JohnFx's method works well. You can also include query string, server variable, and cookie data into the mix by using the Request.Params collection, as in:
foreach(string key in Request.Params.Keys)
{
Response.Write(String.Format("{0}: {1}
", key, Request.Params[key]));
}
You need to be careful when using the Request.Params
collection. If a QUERYSTRING variable and FORM variable both share key "Name" and have values "Val1" and "Val2", then the value of Request.Params["Name"]
will be "Val1, Val2."