Share via


AuthManager.SetAuthTicket Method (PIA)

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

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop
…
Public Sub SetAuthTicket(UserID As String,
  fCookieSupport As Boolean,
  TimeWindow As Integer)

[C#]

using Microsoft.CommerceServer.Interop;
…
void SetAuthTicket(stringUserID,
  boolfCookieSupport,
  intTimeWindow);

Parameters

[Visual Basic .NET]

  • UserID
    A String that contains the unique ID for the current user.
  • fCookieSupport
    A Boolean that indicates whether session cookies are supported.
  • TimeWindow
    An Integer that defines the time window in minutes that the AuthTicketType ticket is valid.

[C#]

  • UserID
    A string that contains the unique ID for the current user.
  • fCookieSupport
    A bool that indicates whether session cookies are supported.
  • TimeWindow
    An int that defines the time window in minutes that the AuthTicketType ticket is valid.

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
&HC1004C23 Invalid character (';' or '%' or '=') present in the UserID or the property name/value pair.
&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.
&HC1004C40 The ticket has reached a maximum size of 4 kilobytes.

[C#]

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

Value Description
0xC1004C23 Invalid character (';' or '%' or '=') present in the UserID or the property name/value pair.
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.
0xC1004C40 The ticket has reached a maximum size of 4 kilobytes.

Remarks

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.

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

If the current user is anonymous, use the SetProfileTicket method to generate a ProfileTicketType ticket.

[Visual Basic .NET]

Example

' oAuthManager is a Commerce AuthManager object
oAuthManager.SetAuthTicket ("JoeUser@microsoft.com", True, 30)

Requirements

Namespace: Microsoft.CommerceServer.Interop

Platforms: Windows 2000, Windows Server 2003

Assembly: mscsauthlib (in mscsauthlib.dll)

See Also

AuthManager Class

AuthManager.IsAuthenticated

Copyright © 2005 Microsoft Corporation.
All rights reserved.