Share via


IMSCSAuthManager2::Initialize Method

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Use this method to initialize the AuthManager object.

HRESULT IMSCSAuthManager::Initialize(
    BSTR bstrSiteName,
);
Sub Initialize(
    bstrSiteName As String
)

Parameters

  • bstrSiteName
    [C++]

    [in] A BSTR that contains the name of the Commerce Server Web site.

    [Visual Basic]

    [in] A String that contains the name of the Commerce Server Web site.

Return Value

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic] If this method completes successfully, it returns a Variant that contains the user ID. If the appropriate ticket type is not found or there is no user ID, the method returns NULL.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

[C++] The AuthManager object must be properly initialized to a valid site name immediately after creating the object and before any other AuthManager object method is used.

The first time any AuthManager object uses this method, it connects to the Administration database and caches the site configuration data using the SiteConfig object. When subsequent AuthManager objects call this method the data is read from the cache.

Use the Refresh method to update the site configuration data after any of the properties have been changed.

Use the UnInitialize method to delete the site-specific configuration resource properties from the cache when the site is no longer valid.

It is suggested that you instantiate and initialize the AuthManager object in the Global.asa file to make sure at least one instance of the object exists, and to ensure the dynamic-link library (DLL) is loaded in memory and not flushed out by Internet Information Services (IIS) for performance reasons. This AuthManager object should not be used elsewhere. A separate instance of the AuthManager object must be created and destroyed on each ASP page.

This method is available when the MSCSAuthManager object is instantiated outside of the context of an ASP script.

Example

' oAuthManager is a AuthManager object.

oAuthManager.Initialize(sSiteName)

See Also

Other Resources

AuthManager Object