HttpRequest.Form 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取窗体变量集合。
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
属性值
表示窗体变量集合的 NameValueCollection。
示例
以下示例演示如何读取从浏览器发布的表单集合中的值。 集合中的每个名称/值对都表示窗体中的控件及其值。
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
注解
当 HTTP 请求Content-Type
值为“application/x-www-form-urlencoded”或“multipart/form-data”时,将Form填充该属性。