Name

Remove

Synopsis

Application.Remove(ByVal name As String)

Removes an item by name from the Application collection.

Parameters

name

A String argument containing the name (key) of the item to remove.

Example

The example determines whether the item with the key “foo” exists in the Application collection and, if it does, removes the item and displays an appropriate message:

Sub Page_Load(  )
   If Not Application("foo") Is Nothing Then
      Application.Remove("foo")
      Message.Text = "Item 'foo' was removed."
   Else
      Message.Text = "Item 'foo' does not exist."
   End If
End Sub

Notes

The Remove method is provided for backwards compatibility with classic ASP. In classic ASP, this method was accessed through the Contents collection. In ASP.NET, this method can be accessed either directly, as shown above, or through the Contents collection.

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.