UserControl.Application Property
Gets the Application object for the current Web request.
[Visual Basic] Public ReadOnly Property Application As HttpApplicationState [C#] public HttpApplicationState Application {get;} [C++] public: __property HttpApplicationState* get_Application(); [JScript] public function get Application() : HttpApplicationState;
Property Value
The HttpApplicationState object for the current Web request.
Example
[Visual Basic, C#] The following example adds two key value pairs to the application state associated with a user control if the user control's IsPostBack property returns false. When this condition is met, the code uses the Add method, through the user control's Application property, to add the keys and their values.
[Visual Basic] If (Not myControl.IsPostBack) Then ' Add new objects to the HttpApplicationState. ' These will be maintained as long as the as the application is active. myControl.Application.Add("Author","Shafeeque") myControl.Application.Add("Date",new DateTime(2001,6,21)) [C#] if (!myControl.IsPostBack) { // Add new objects to the HttpApplicationState. // These will be maintained as long as the application is active. myControl.Application.Add("Author","Shafeeque"); myControl.Application.Add("Date",new DateTime(2001,6,21));
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
UserControl Class | UserControl Members | System.Web.UI Namespace | HttpApplicationState | Application