IssueCookieToOldUser Method

This method issues the necessary cookies to a new registered user account that has been migrated from a previous anonymous cookie account.  The GUID value for the new registered account will be the same as for the old cookies account.

IDL Definition

HRESULT IssueCookieToOldUser(BSTR bszUserName);

Parameters

bszUserName

The new username to issue the old cookie to

Return Values

a standard HRESULT value

Remarks

When migrating users, make sure to actually move the account information to its new location before invoking IssueCookieToOldUser.  The GUID value will be fetched for the user using the new account information.

Example

This example migrates an anonymous cookies user to the members container using the new username.

VBscript in an ASP Page

<% Set oUserObject = Server.CreateObject("membership.userobjects.1")

   UserName = "JohnS"
    if Request.Cookies("SITESERVER")("GUID") <> "" Then
      '
      ' Get the parent object
      Set ParentUserObject =  oUserObject.GetObjectAsUser(oUserObject.Parent)
      '
      ' Get the grandparent object
      Set TargetContainer = oUserObject.GetObjectAsUser(ParentUserObject.Parent)
      '
      'Move the object to the target container
      TargetContainer.MoveHere oUserObject.ADsPath, "cn=" & UserName
      '
      ' create cookie object
      Set NewCookie = Server.CreateObject("Membership.verifusr")
      '
      ' Issue cookie to the old user
      NewCookie.IssueCookieToOldUser(cstr(UserName))
   End if
%>

© 1997-1998 Microsoft Corporation. All rights reserved.