AuthManager.GetUserID Method (PIA)

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

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop
…
Public Function GetUserID(enumTicketType As TicketTypeEnum) As Object

[C#]

using Microsoft.CommerceServer.Interop;
…
object GetUserID(TicketTypeEnumenumTicketType);

Parameters

[Visual Basic .NET]

  • enumTicketType
    A TicketTypeEnum that indicates the type of ticket that contains the user ID.

[C#]

  • enumTicketType
    A Microsoft.CommerceServer.Interop.TicketTypeEnum value (for example, AuthTicketType or ProfileTicketType) that indicates the type of ticket that contains the user ID.

Return Values

[Visual Basic .NET] If this method completes successfully, it returns an Object that contains the user ID. If the appropriate ticket type is not found or there is no user ID, the method returns Null.

[C#] This method returns an object containing a string 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 object is set to DBNull.Value.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

[Visual Basic .NET]

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

Value Description
&HC1004C24 This method should only be called within an ASP page.
&HC1004C10 The Initialize method must be called with the installed site name before calling this method.

[C#]

The following table shows the custom COM errors that a COMException can wrap.

Value Description
0xC1004C24 This method should only be called within an ASP page.
0xC1004C10 The Initialize method must be called with the installed site name before calling this method.

Remarks

The following table defines the possible values for the TicketType.

Name Value Description
ProfileTicketType 1 A Profile ticket used for an anonymous user.
AuthTicketType 2 An Auth ticket used for a registered user.

If the ticket type is AuthTicketType 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 AuthTicketType 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.

[Visual Basic .NET]

Example

' oUserID is an Object
' oAuthManager is a Commerce AuthManager object
oUserID = oAuthManager.GetUserID(ProfileTicketType)

Requirements

Namespace: Microsoft.CommerceServer.Interop

Platforms: Windows 2000, Windows Server 2003

Assembly: mscsauthlib (in mscsauthlib.dll)

See Also

AuthManager Class

Copyright © 2005 Microsoft Corporation.
All rights reserved.