Share via


IMSCSAuthManager2::GetUserID Method

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

Use this method to retrieve the user ID stored in a ticket.

HRESULT IMSCSAuthManager::GetUserID(
    EnumMSCS_TicketType enumTicketType,
    VARIANT* pUserID
);
Function GetUserID(
    enumTicketType As EnumMSCS_TicketType
) As Variant

Parameters

  • enumTicketType
    [C++]

    [in] An EnumMSCS_TicketType that indicates the type of ticket that contains the user ID.

    [Visual Basic]

    [in] An EnumMSCS_TicketType that indicates the type of ticket that contains the user ID.

  • pUserID
    [C++]

    [out, retval] A pointer to a VARIANT containing a BSTR used to return the unique ID for the current user. If the appropriate ticket type is not found or there is no user ID, the returned VARIANT is set to type VT_NULL.

    [Visual Basic]

    Not applicable.

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.

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

Constant

Value

Description

E_UPM_AUTHMANAGER_API_ASP_ONLY

[C++] 0xC1004C24

[Visual Basic] &HC1004C24

This method should only be called within an ASP page.

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

[C++] The pbstrRet parameter contains valid data only if the method completes successfully.

The following table defines the possible values for the EnumMSCS_TicketType.

Name

Value

Description

enumMSCS_ProfileTicketType

1

An MSCSProfile ticket used for an anonymous user.

enumMSCS_AuthTicketType

2

An MSCSAuth ticket used for a registered user.

If the ticket type is an MSCSAuth ticket and the ticket has expired, the ticket will be deleted and the return value will be as if there was no ticket.

If the ticket type is an MSCSAuth ticket and the ticket is within five minutes of expiring, the last login time is refreshed to the current time, allowing an additional period for the ticket to be valid.

Example

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

vUserID = oAuthManager.GetUserID(enumMSCS_ProfileTicketType)

See Also

Other Resources

AuthManager Object