ALP Application.Value default indexed property

Value property of the Application object provides easy to use syntax to the scripts. Through the Value property values and objects can be set/get to/from the Contents collection and get (only) from the StaticObjects collection.

Syntax:

  1. Application.Value(key_name) = variable
    variable = Application.Value(key_name)

  2. Application(key_name) = variable
    variable = Application(key_name)

Parameters:

key_name - string that is used as label for the value/object being set/retrieved to/from the collection.

variable - any variable that can be converted to a value such as number and string or object. Object being set can not be an internal scripting object! See remarks section for more details.

If key_name does not exist in the collection Empty (VT_EMPTY) is returned (if the IIS compatibility level is set to 0 - Null is returned for compatibility with ALP 1.0). 

In case of assignment Value property automatically creates the key_name if the key does not exist in the Contents collection.

Samples:

<% Application("UserName") = strUser %>

<%
    Dim obj
    Set obj = Server.CreateObject("Company.SomeObject")
    Application("TheObject") = obj
%>

<%
    var fso = Server.CreateObject("Scripting.FileSystemObject");
    var dir = fso.GetFolder(Server.MapPath(".");
    Application("LastDirectory") = dir;
%>

Remarks:

Value property mostly manages the Contents collection and can be called a "Contents collection helper". Remarks for the Contents collection are true for the Value property.

Applies to: Application object

See also: Application.Contents, VarDictionary

newObjects Copyright 2001-2006 newObjects [ ]