C# - How to list out variable names and values posted to ASPX page

后端 未结 8 2314
春和景丽
春和景丽 2021-02-13 10:11

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

8条回答
  •  失恋的感觉
    2021-02-13 10:26

    Have you tried something like this:

    For post request:

    foreach(string key in Request.Form.Keys ) 
    {
       Response.Write ( Request.Form[key] );
    }  
    

    For a get request:

    foreach(string key in Request.QueryString.Keys ) 
    {
       Response.Write ( Request.QueryString[key] );
    }
    

提交回复
热议问题