Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Ruft das Application-Objekt für die aktuelle Webanforderung ab.
Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)
Syntax
'Declaration
Public ReadOnly Property Application As HttpApplicationState
'Usage
Dim instance As UserControl
Dim value As HttpApplicationState
value = instance.Application
public HttpApplicationState Application { get; }
public:
property HttpApplicationState^ Application {
HttpApplicationState^ get ();
}
/** @property */
public HttpApplicationState get_Application ()
public function get Application () : HttpApplicationState
Eigenschaftenwert
Das HttpApplicationState-Objekt für die aktuelle Webanforderung.
Beispiel
Im folgenden Beispiel werden dem mit einem Benutzersteuerelement verknüpften Anwendungszustand zwei Schlüssel-Wert-Paare hinzugefügt, wenn die IsPostBack-Eigenschaft des Benutzersteuerelements false zurückgibt. Wenn diese Bedingung erfüllt ist, werden die Schlüssel und ihre jeweiligen Werte vom Code über die Application-Eigenschaft des Benutzersteuerelements mithilfe der Add-Methode hinzugefügt.
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))
' Add an object to the cache with expirations
' set to 0.1 minute.
myControl.Cache.Insert("MyData1", "somevalue", Nothing, DateTime.Now.AddMinutes(0.1), Cache.NoSlidingExpiration)
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));
// Add an object to the cache with expirations
// set to 0.1 minute.
myControl.Cache.Insert("MyData1", "somevalue", null, DateTime.Now.AddMinutes(0.1), Cache.NoSlidingExpiration);
}
if (!myControl.get_IsPostBack()) {
// Add new objects to the HttpApplicationState.
// These will be maintained as long as the application is active.
myControl.get_Application().Add("Author","Shafeeque");
myControl.get_Application().Add("Date",new DateTime(2001,6,21));
Plattformen
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
UserControl-Klasse
UserControl-Member
System.Web.UI-Namespace
HttpApplicationState
Page.Application-Eigenschaft