Share via


IMSCSAuthManager2::SetAuthTicket Method

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

Use this method to set an encrypted MSCSAuth ticket for a registered user.

HRESULT IMSCSAuthManager::SetAuthTicket(
    BSTR UserID,
    VARIANT_BOOL fCookieSupport,
    long TimeWindow
);
Sub SetAuthTicket(
    UserID As String,
    fCookieSupport As Boolean,
    TimeWindow As Long
)

Parameters

  • UserID
    [C++]

    [in] A BSTR that contains the unique ID for the current user.

    [Visual Basic]

    [in] A String that contains the unique ID for the current user.

  • fCookieSupport
    [C++]

    [in] A VARIANT_BOOL that indicates whether session cookies are supported.

    [Visual Basic]

    [in] A Boolean that indicates whether session cookies are supported.

  • TimeWindow
    [C++]

    [in] A long that defines the time window in minutes that the MSCSAuth ticket is valid.

    [Visual Basic]

    [in] A Long that defines the time window in minutes that the MSCSAuth ticket is valid.

Return Value

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

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_AUTHID_INVALID_CHARACTER_PRESENT

[C++] 0xC1004C23

[Visual Basic] &HC1004C23

Invalid character (';' or '%' or '=') present in the user ID or the property name/value pair.

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.

MSG_UPM_AUTHID_TICKET_MAX_REACHED

[C++] 0xC1004C40

[Visual Basic] &HC1004C40

The ticket has reached a maximum size of 4 Kilobytes of data.

[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 time the user last logged in is stored in the ticket, along with the length of time from the last login that the ticket is valid. This method will set the last login time to the current time on the local computer each time it is invoked.

If the current user is anonymous, use the SetProfileTicket method to generate an MSCSProfile ticket.

Warning

If an MSCSAuth ticket for the user already exists and an empty string is passed in as the ID for the user, the existing ticket is deleted.

Example

' oAuthManager is a AuthManager object.

oAuthManager.SetAuthTicket "JoeUser@microsoft.com", True, 30

See Also

Other Resources

AuthManager Object