C# - How to list out variable names and values posted to ASPX page(C# - 如何列出发布到 ASPX 页面的变量名称和值)
问题描述
我正在动态生成一个提交到 .aspx 网页的 HTML 表单.如何在结果页面中确定提交了哪些变量名称以及值是什么?使用:Request["VarName"].toChar();有效,但假设我知道所有变量名称.如何获取名称和值?
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 values were? Using: Request["VarName"].toChar(); Works, but assumes that I know all of the variable names. How can I get the names and values?
理想情况下,该解决方案适用于 POST 和 GET 提交...
Ideally, the solution would work for both POST and GET submissions...
谢谢!
推荐答案
你是否尝试过这样的事情:
Have you tried something like this:
对于发布请求:
foreach(string key in Request.Form.Keys )
{
Response.Write ( Request.Form[key] );
}
对于获取请求:
foreach(string key in Request.QueryString.Keys )
{
Response.Write ( Request.QueryString[key] );
}
这篇关于C# - 如何列出发布到 ASPX 页面的变量名称和值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:C# - 如何列出发布到 ASPX 页面的变量名称和值
基础教程推荐
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- WPF 模态进度窗口 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- C# 从 List<List<int>> 中删除重 2022-01-01
