ISessionObject::put_Value

This method stores a variant in the Session object. If the variant is a COM Automation object, then ASP will attempt to store the default value of that object into the application. If ASP cannot get the default value, then the call will fail.

HRESULT put_Value(
  BSTR bstrValue,  //binary string that contains the variable name
  VARIANT var      //VARIANT that contains the variable value
);
 

Parameters

bstrValue
A binary string that contains the variable name.
var
A variant that contains the variable value.

Remarks

If you store an array in a Session object, you should not attempt to alter the elements of the stored array directly. For example, the following script will not work.

<% Session("StoredArray")(3) = "new value" %>
 

This is because the Session object is implemented as a collection. The array element StoredArray(3) does not receive the new value. Instead, the value is indexed into the collection, overwriting any information stored at that location.

It is strongly recommended that if you store an array in the Session object, you retrieve a copy of the array before retrieving or changing any of the elements of the array. When you are done with the array, you should store the array in the Session object again so that any changes you made are saved.

See Also

Session Object, ISessionObject::get_Value