Export (0) Print
Expand All

Page.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 current data in the HttpApplicationState class.

Example

[Visual Basic] 
' When this page is loaded, the source for the 
' MyDataGrid control is obtained from Application state,
' which is stored in the application's Global.asax file.
Sub Page_Load(Src As Object, E As EventArgs)

    Dim Source As DataView = Application("Source")
    MySpan.Controls.Add(New LiteralControl(Source.Table.TableName))
    MyDataGrid.DataSource = Source
    MyDataGrid.DataBind()
End Sub

[C#] 
// When this page is loaded, the source for the 
// MyDataGrid control is obtained from Application state,
// which is stored in the application's Global.asax file.
void Page_Load(Object Src, EventArgs E ) {

    DataView Source = (DataView)(Application["Source"]);
    MySpan.Controls.Add(new LiteralControl(Source.Table.TableName));
    MyDataGrid.DataSource = Source;
    MyDataGrid.DataBind(); 
}

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

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

See Also

Page Class | Page Members | System.Web.UI Namespace | HttpApplicationState

Show:
© 2014 Microsoft