HttpRequest.Form 属性
获取窗体变量集合。
**命名空间:**System.Web
**程序集:**System.Web(在 system.web.dll 中)
语法
声明
Public ReadOnly Property Form As NameValueCollection
用法
Dim instance As HttpRequest
Dim value As NameValueCollection
value = instance.Form
public NameValueCollection Form { get; }
public:
property NameValueCollection^ Form {
NameValueCollection^ get ();
}
/** @property */
public NameValueCollection get_Form ()
public function get Form () : NameValueCollection
属性值
表示窗体变量集合的 NameValueCollection。
备注
当 HTTP 请求 Content-Type 值为“application/x-www-form-urlencoded”或“multipart/form-data”时,会填充 Form 属性。
主题 | 位置 |
---|---|
如何:在 ASP.NET 网页之间传递值 | 在 Visual Studio 中生成 ASP .NET Web 应用程序 |
如何:在 ASP.NET 网页之间传递值 | 在 Visual Studio 中生成 ASP .NET Web 应用程序 |
如何:在 ASP.NET 网页之间传递值 | 生成 ASP .NET Web 应用程序 |
示例
下面的代码示例捕获客户端的窗体集合并将每个窗体的名称写入 HTTP 输出。
Dim loop1 As Integer
Dim arr1() As String
Dim coll As NameValueCollection
' Load Form variables into NameValueCollection variable.
coll=Request.Form
' Get names of all forms into a string array.
arr1 = coll.AllKeys
For loop1 = 0 To arr1.GetUpperBound(0)
Response.Write("Form: " & arr1(loop1) & "<br>")
Next loop1
int loop1;
NameValueCollection coll;
//Load Form variables into NameValueCollection variable.
coll=Request.Form;
// Get names of all forms into a string array.
String[] arr1 = coll.AllKeys;
for (loop1 = 0; loop1 < arr1.Length; loop1++)
{
Response.Write("Form: " + arr1[loop1] + "<br>");
}
int loop1;
NameValueCollection coll;
//Load Form variables into NameValueCollection variable.
coll = get_Request().get_Form();
// Get names of all forms into a string array.
String arr1[] = coll.get_AllKeys();
for (loop1 = 0; loop1 < arr1.length; loop1++) {
get_Response().Write(("Form: " + arr1[loop1] + "<br>"));
}
var arr1 : String[]
var coll : NameValueCollection
coll=Request.Form // Load Form variables into NameValueCollection variable.
arr1 = coll.AllKeys // Get names of all forms into a string array.
for(var i=0; i < arr1.Length; i++){
Response.Write("Form: " + arr1[i] + "<br>")
}
平台
Windows 98、Windows 2000 SP4、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
请参见
参考
HttpRequest 类
HttpRequest 成员
System.Web 命名空间
ValidateInput
HttpRequest.Cookies 属性
QueryString