This documentation is archived and is not being maintained.

HttpFileCollection.GetKey Method

Returns the name of the HttpFileCollection member with the specified numerical index.

[Visual Basic]
Public Function GetKey( _
   ByVal index As Integer _
) As String
[C#]
public string GetKey(
 int index
);
[C++]
public: String* GetKey(
 int index
);
[JScript]
public function GetKey(
   index : int
) : String;

Parameters

index
The index of the object name to be returned.

Return Value

The name of the HttpFileCollection member specified by index.

Example

The following example loops through the file collection and takes action if a file collection member with the name "CustInfo" is found.

[Visual Basic] 
Dim loop1 As Integer
 Dim MyFileColl As HttpFileCollection = Request.Files
 
 For loop1 = 0 To MyFileColl.Count - 1
    If MyFileColl.GetKey(loop1) = "CustInfo" Then
       '...
    End If
 Next loop1
    

[C#] 
int loop1;
 HttpFileCollection MyFileColl = Request.Files;
 
 for( loop1 = 0; loop1 < MyFileColl.Count; loop1++)
 {
    if( MyFileColl.GetKey(loop1) == "CustInfo")
    {
       //...
    }
 }
    

[C++] 
int loop1;
 HttpFileCollection* MyFileColl = Request->Files;
 
 for( loop1 = 0; loop1 < MyFileColl->Count; loop1++)
 {
    if( MyFileColl->GetKey(loop1)->Equals(S"CustInfo"))
    {
       //...
    }
 }
    

[JScript] 
var myFileColl : HttpFileCollection = Request.Files

for(var i=0; i < myFileColl.Count; i++){
  if(myFileColl.GetKey(i) == "CustInfo"){
      //...
  }
}
  

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HttpFileCollection Class | HttpFileCollection Members | System.Web Namespace

Show: