HttpRequest.Form 属性

定义

获取窗体变量集合。Gets a collection of form variables.

public:
 property System::Collections::Specialized::NameValueCollection ^ Form { System::Collections::Specialized::NameValueCollection ^ get(); };
public System.Collections.Specialized.NameValueCollection Form { get; }
member this.Form : System.Collections.Specialized.NameValueCollection
Public ReadOnly Property Form As NameValueCollection

属性值

表示窗体变量集合的 NameValueCollectionA NameValueCollection representing a collection of form variables.

示例

下面的示例演示如何读取从浏览器发布的窗体集合中的值。The following example shows how to read the values in the form collection posted from a browser. 集合中的每个名称/值对都表示一个窗体中的控件及其值。Each name/value pair in the collection represents a control in the form and its value.

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>");
}
   
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
   

注解

Form HTTP 请求Content-Type值为 "url 编码" 或 "多部分/窗体数据" 时,将填充该属性。The Form property is populated when the HTTP request Content-Type value is either "application/x-www-form-urlencoded" or "multipart/form-data".

适用于

另请参阅