This documentation is archived and is not being maintained.
HttpRequest.Form Property
.NET Framework 1.1
Gets a collection of form variables.
[Visual Basic] Public ReadOnly Property Form As NameValueCollection [C#] public NameValueCollection Form {get;} [C++] public: __property NameValueCollection* get_Form(); [JScript] public function get Form() : NameValueCollection;
Property Value
A NameValueCollection representing a collection of form variables.
Remarks
Populated when the HTTP request Content-Type is either application/x-www-form-urlencoded or multipart/form-data.
Example
The following example captures a client's form collection and writes the name of each form to HTTP output.
[Visual Basic] 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 [C#] 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>"); } [C++] 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(String::Format(S"Form: {0}<br>", arr1[loop1])); } [JScript] 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>") }
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
HttpRequest Class | HttpRequest Members | System.Web Namespace
Show: