Export (0) Print
Expand All

HttpApplicationState.GetKey Method

Gets an HttpApplicationState object name by 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 application state object.

Return Value

The name under which the application state object was saved.

Example

The following example returns the names of all the objects in the application state collection and stores the names in a string array.

[Visual Basic] 
Dim Loop1 As Integer
 Dim StateVars(Application.Count) As String
 
 For Loop1 = 0 To Application.Count -1
    StateVars(Loop1) = Application.GetKey(Loop1)
 Next Loop1
   

[C#] 
int Loop1;
 String[] StateVars = new String[Application.Count];
 
 for (Loop1 = 0; Loop1 < Application.Count; Loop1++)
 {
    StateVars[Loop1] = Application.GetKey(Loop1);
 }
   

[C++] 
int Loop1;
 String* StateVars[] = new String*[Application->Count];
 
 for (Loop1 = 0; Loop1 < Application->Count; Loop1++)
 {
    StateVars[Loop1] = Application->GetKey(Loop1);
 }
   

[JScript] 
var loop1 : int
var stateVars : String[] = new String[Application.Count]

for(loop1 = 0; loop1 < Application.Count; loop1++)
  stateVars(loop1) = Application.GetKey(loop1)

Requirements

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

See Also

HttpApplicationState Class | HttpApplicationState Members | System.Web Namespace

Show:
© 2014 Microsoft