Name
Application
Synopsis
HttpApplicationState = Page.Application
Returns an instance of the
HttpApplicationState
class, which is the equivalent of the ASP
intrinsic Application object. An instance of the
HttpApplicationState class contains global
information that can be shared across multiple sessions and requests
within an ASP.NET application. For more information on the
HttpApplicationState class and its members, see
Chapter 13.
Parameters
-
HttpApplicationState A variable of type HttpApplicationState that receives the instance of the
HttpApplicationStateclass.
Example
The following code example uses Page object’s
Application property to add a name/value pair to the Application
object and display the value in a label control. Since all of the
properties of the Page object are exposed directly to any code
associated with the page, it is not necessary to explicitly name the
Page class (i.e.,
Page.Application) to access the Application
property.
Sub Page_Load( )
Application("Name") = "John Doe"
Message.Text = "The value <em>" & CStr(Application("Name")) & _
"</em> has been added to the Application collection."
End SubNotes
Although you can retrieve a local object reference to the HttpApplicationState instance for the application, the more common use of this property is to access it directly through the Application property, as shown in the example.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access