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 填入屬性。