IMSCSAuthManager2::GetUserIDFromCookieAndKey Method [C++]

Use this method to retrieve the user ID stored in a cookie using an encryption key.

Definition

[C++]

HRESULT IMSCSAuthManager2::GetUserIDFromCookieAndKey(BSTRcookieData,
  BSTRencryptionKey,
  BSTR*pbstrUserID);

[Visual Basic]

Function GetUserIDFromCookieAndKey(cookieData As String,
  encryptionKey As String) As String

Parameters

  • cookieData[C++]
    [in] A BSTR that contains the cookie.
  • cookieData[Visual Basic]
    [in] A String that contains the cookie.
  • encryptionKey[C++]
    [in] A BSTR that contains the encryption key.
  • encryptionKey[Visual Basic]
    A String that contains the encryption key.
  • pbstrUserID[C++]
    [out, retval] A pointer to a BSTR used to return the user ID.

Return Values

[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 String that contains the user ID.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and either standard or custom 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 either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM error that this method can return.

Constant Value Description
MSG_UPM_AUTH_SITE_NEEDED_ERROR [C++] 0xC1004C10

[Visual Basic] &HC1004C10

The Initialize method must be called with the installed site name before calling this method.

[C++] Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

The cookie data is always URL decoded.

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

This method is similar to the GetUserIDFromCookie method, but allows you to specify the encryption key. This enables the decryption of persistent cookies when the ticket encryption keys have changed. Retaining the user ID when replacing outdated cookies prevents the Business Analytics System from treating the returning user as a new user.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[C++]

The pbstrUserID parameter contains valid data only if the method completes successfully.

[Visual Basic]

Example

' vUserID is a Variant
' oAuthManager is a Commerce AuthManager object

vUserID = oAuthManager.GetUserIDFromCookieAndKey(sCookieData, sKey)

See Also

[C++]AuthManager Object

[Visual Basic]AuthManager Object

Copyright © 2005 Microsoft Corporation.
All rights reserved.