IssueOldCookiesToNewUser Method

This method issues the Membership cookies to a specified new user.  It is used when creating a new user that had a previously set anonymous GUID value.

IDL Definition

HRESULT IssueOldCookiesToNewUser(
BSTR bszUserName,  
BSTR bstrUserGUID
);

Parameters

bszUserName

The new username to issue the cookies under

bszUserGUID

The previous GUID value for the user

Return Values

a standard HRESULT value

Remarks

This method should only be used when creating a new user account for a user that already has a GUID value stored with the Membership directory service.

Example

NewUserName = "FredJ"
  ID = "o=company/ou=members/cn=administrator"
  Password = "password"

  Set IUserObjects = Server.CreateObject("Membership.UserObjects.1")
  '  assume this AUO is going to be used to create a new user
  ' with username "FredJ"

  ' set the new username in the AUO
  IUserObjects.SetUserName(cstr(NewUserName))

  ' use these binding credentials to access the DS
  IUserObjects.BinsAs "", ID,Password

  '  Now work with cookies  
  Set IVerifUsr = Server.CreateObject("Membership.VerifUsr.1")
  '  Check to see if the user already has a GUID
  If Request("MEMUSER") <> "" Then
    ' No GUID;  Issue Cookies and Get a new GUID
    GUIDValue = IVerifUsr.IssueCookiesToNewUser(Username)

    '  ADSI object loaded and the value put to the object
    IUserObjects.Put "GUID", cstr(GUIDValue)

  Else
    GUIDValue = IUserObjects.Get("GUID")
    IVerifUsr.IssueOldCookiesToNewUser Username, GUIDValue
  End If
    '  Now the new user with DN cn=FredJ exists in the default 
    ' AUO provider and the necessary cookies will be sent with 
    ' the response from this page

  IUserObjects.SetInfo

%>

© 1997-1998 Microsoft Corporation. All rights reserved.