Init Method

The Init method is used to initialize the object with a username and an Internet Information Server virtual server instance identifier.

IDL Definition

HRESULT Init(
BSTR bszIISVirtId,
BSTR bszUserName
);

Parameters

bszIISVirtId

An Internet Information Server virtual server instance identifier

bszUserName

The user name (from REMOTE_USER variable)

Return Value

a standard HRESULT value

Remarks

The bszIISVirtId is used to map to the corresponding Membership virtual server instance, and hence a set of AUO entries.

The bszUserName is used to complete the ADs path to the user's directory information when ADSI objects are requested of the UserObjects object.

The Init method is invoked automatically within in the OnStartPage method which is always invoked on the object when the Server dispinterface method CreateObject is used to create the instance.  The IIS virtual server instance identifier (INSTANCE_ID) and the current username (REMOTE_USER) are fetched from the Request object to be sent as arguments.

In a non-ASP environment, one must explicitly call the Init method.

Example

VBScript in an ASP page

<% Set IUserObjects = CreateObject("Membership.UserObjects")

'  Note here that the Server dispinterface (object) was not used to create the object
'  In this case, the OnStartPage method was not called, so we must do so

Username = Request.ServerVariables("REMOTE_USER")
IISVirtId = Request.ServerVariables("INSTANCE_ID")
call IUserObjects.Init(IISVirtId,Username)

See Also

OnStartPage Method


© 1997-1998 Microsoft Corporation. All rights reserved.