Open Method  
 

Open a storage container.

Syntax

object.Open( [AppId], [StorageType], [Timeout] )

Parameters

AppId
A string which specifies the application ID for the storage container. The application ID is a string that uniquely identifies the application and can only contain letters, numbers, the period and the underscore character. If this parameter is omitted or an empty string, the default identifier SocketTools.Storage.Default will be used.
StorageType
A numeric value that identifies the storage container type. One of the following values should be specified. If this parameter is omitted, global storage will be used by default.
Value Constant Description
1 webStorageGlobal Global storage. Objects stored using this storage type are available to all users. Any changes made to objects using this storage type will affect all users of the application. Unless there is a specific need to limit access to the objects stored by the application to specific domains, local machines or users, it is recommended that you use this storage type when creating new objects.
2 webStorageDomain Local domain storage. Objects stored using this storage type are only available to users in the same local domain, as defined by the domain name or workgroup name assigned to the local system. If the domain or workgroup name changes, objects previously stored using this storage type will not be available to the application.
3 webStorageMachine Local machine storage. Objects stored using this storage type are only available to users on the same local machine. The local machine is identified by unique characteristics of the system, including the boot volume GUID. Objects previously stored using this storage type will not be available on that system if the boot disk is reformatted.
4 webStorageUser Current user storage. Objects stored using this storage type are only available to the current user logged in on the local machine. The user identifier is based on the Windows user SID that is assigned when the user account is created. If the user account is deleted, the objects previously stored using this storage type will not be available to the application.
Timeout
The number of seconds that the client will wait for a response before failing the operation. If this argument is not specified, the value of the Timeout property will be used as the default.

Return Value

A value of True is returned if the storage container was opened. Otherwise, a value of False is returned and the LastError property will return the specific cause of the failure.

Remarks

The Open method opens the specified storage container and requests an access token for the application. This method that must be called prior to accessing any stored objects.

The application ID is a string that uniquely identifies the application requesting the access and must have been previously registered with the server by calling the RegisterId method. If the AppId parameter is omitted or an empty string, the a default internal ID will be used which is allocated for each storage account. You can use this default ID if you wish to share data between all of the applications you create.

The storage type specifies the type of container that objects will be stored in. In most cases, we recommend using webStorageGlobal which means that stored objects will be accessible to all users of your application. However, you can limit access to the stored objects based on the local domain, local machine ID or the current user SID.

If you specify anything other than global storage, objects can be orphaned if the system configuration changes. For example, if webStorageMachine is specified, the objects that are stored there can only be accessed from that computer system. If the system is reconfigured (for example, the boot volume formatted and Windows is reinstalled) the unique identifier for that system will change and the previous objects that were stored by your application wil no longer be accessible.

It is advisable is to store critical application data and configuration information in the webStoragebGlobal container and use other non-global storage containers for configuration information that is unique to that system and/or user which is not critical and can be easily recreated.

See Also

AppId Property, StorageType Property, Timeout Property, Close Method, RegisterId Method