HttpRequest.Form Egenskap

Definition

Hämtar en samling formulärvariabler.

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

Egenskapsvärde

En NameValueCollection som representerar en samling formulärvariabler.

Exempel

I följande exempel visas hur du läser värdena i formulärsamlingen som publicerats från en webbläsare. Varje namn/värde-par i samlingen representerar en kontroll i formuläret och dess värde.

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
   

Kommentarer

Egenskapen Form fylls i när HTTP-begärandevärdet Content-Type antingen är "application/x-www-form-urlencoded" eller "multipart/form-data".

Gäller för

Se även