次の方法で共有


ISessionObject::put_Value

This method stores a VARIANT in the Session Object 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,
   VARIANT var
);

Parameters

  • bstrValue
    [in] A binary string that contains the variable name.

  • var
    [in] 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.

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

See Also