ASP.NET(vb.net) & Application Variables - Application : You can use the Application object to share information among all users of a given application. An ASP-based application is defined as all the .asp files in a virtual directory and its subdirectories. Because the Application object can be shared by more than one user, there are Lock and Unlock methods to ensure that multiple users do not try to alter a property simultaneously.
ShotDev Focus:
- ASP.NET(vb.net) & Application Variables
Example
AspNetApplication.aspx
<%@ Page Language="VB" %> <script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Application("Database") = "mydatabase.mdb" Application("UserID") = "myuser" Application("Password") = "mypassword" ViewApplication() End Sub Sub ViewApplication() Me.lblText1.Text = "Database = " & Application("Database") Me.lblText2.Text = "UserID = " & Application("UserID") Me.lblText3.Text = "Password = " & Application("Password") End Sub </script> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form id="form1" runat="server"> <asp:Label id="lblText1" runat="server"></asp:Label><br /> <asp:Label id="lblText2" runat="server"></asp:Label><br /> <asp:Label id="lblText3" runat="server"></asp:Label><br /> </form> </body> </html>
Screenshot
.
.
.
Download this script.
.
.
.
Property & Method
ASP.NET(vb.net) Application.Add() - Application Object
ASP.NET(vb.net) Application.Set() - Application Object
ASP.NET(vb.net) Application.Clear() - Application Object
ASP.NET(vb.net) Application.Remove() - Application Object
ASP.NET(vb.net) Application.RemoveAt() - Application Object
ASP.NET(vb.net) Application.RemoveAll() - Application Object
ASP.NET(vb.net) Application.Contents() - Application Object
ASP.NET(vb.net) Application.Contents.Remove() - Application Object
ASP.NET(vb.net) Application.Contents.RemoveAt() - Application Object
ASP.NET(vb.net) Application.Contents.RemoveAll() - Application Object
ASP.NET(vb.net) Application.Count() - Application Object
ASP.NET(vb.net) Application.Item() - Application Object
ASP.NET(vb.net) Application.Keys() - Application Object
ASP.NET(vb.net) Application.AllKeys() - Application Object
ASP.NET(vb.net) Application.StaticObjects() - Application Object
ASP.NET(vb.net) Application.Lock() - Application Object
ASP.NET(vb.net) Application.UnLock() - Application Object
ASP.NET(vb.net) Application_Start() - Application Object
ASP.NET(vb.net) Application_End() - Application Object
ASP.NET(vb.net) Application_Error() - Application Object