Name
Set
Synopsis
Application.Set(ByVal name As String, ByVal value As Object)
Updates the value of an object in the Application collection. This new method allows you to set objects in the Application collection.
Parameters
-
Name
A String argument containing the name of the object in the Application collection to be updated.
-
Value
An Object argument containing the new value of the Application collection object to be updated.
Example
The example uses Set twice -- once to set a new item in the Application collection and again to change that value.
Sub Page_Load( ) Application.RemoveAll( ) Application.Set("TotallyNewVariable","Test!") Message.Text = "First: " + Application("TotallyNewVariable") + "<br/>" Application.Set("TotallyNewVariable","Test again!") Message.Text = Message.Text & "First after Set: " + Application("TotallyNewVariable") + "<br/>" End Sub
Notes
Set can be used to add values to the Application collection, but you will normally just use the simple syntax you are used to from classic ASP:
Application("TotallyNewVariable") = "Test!"
Get ASP.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.