C#:获取从表单发布的值 [英] c#: get values posted from a form

查看:83
本文介绍了C#:获取从表单发布的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用带有方法post的表单从另一个页面发布一些数据.我想知道的是:什么是获得价值的最佳方法.以eacn名称的形式显示为

Im posting some data from another page using a form with the method post. What i would like to know is: Whats the best way to get the values. Going by eacn name in the form as

Request["name"]

或者有什么方法可以收集数据并通过它进行发送?谢谢

Or is there any way to get a collection of the data and itterate through it? Thanks

推荐答案

您可以使用

You can use Request.Form, where the Form property is a collection of the form values:

foreach (var key in myCol.AllKeys)
{
     Response.Write(Request.Form[key]);
}

这篇关于C#:获取从表单发布的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆