Configuring the AUO

The following code examples demonstrate how to configure the Active User Object (AUO) system for our new Membership Server instance.  In this case, we will configure both the default provider as well as add another named provider with the name "Other." 

C++

This example demonstrates the process of creating and using the AuoConfig coclass in a C++ program.  This class and associated COM interfaces are defined within the IDL file auo.idl

Create the project directory for the C++ source code.  The header files and GUID definitions are required, so we run the MIDL compiler on an appropriate interface definition language  (IDL) file.  One can either copy the file auo.idl from the \include directory of the SDK into the project directory, or use the OleView.exe application to bind to the type library and list the IDL definition.  In the latter case, simply bind to the type library, which is located within the dynamic link library c:\microsoft site server\bin\p&m\auo.dll.  Once bound, click on the type library node in the tree.  Select all the IDL text in the right pane and paste it into your favorite text editor.  Save the text into a file named auo.idl.  We now run the MIDL compiler with this file as the argument.  This generates the necessary files:

auo.h

auo_i.c

auo.tlb

If you run MIDL on the auo.idl file that accompanies the SDK, two other files would be generated:

auo_p.c

dlldata.c

These files are used to build a proxy dynamic link library that could be used to marshal data to and from an instance of the object.  Since the desired interfaces are marked with the dual attribute, the oleautomation attribute is implied.  Thus, the automation library can handle all marshalling duties using the type library within the AUO.DLL, and these files can therefore be ignored and/or discarded.

Scripting Languages Example

VBScript and Windows Scripting Host

The following code demonstrates a standard configuration for the AUO system.  The important methods are highlighted.

Set IObjCreator = CreateObject("ObjCreator.ObjCreator.1")
Set IAuoConfig = IObjCreator.CreateObjAuth("MemAdmin.AuoConfig")

'  configure Membership virtual server that is mapped to IIS virtual server 3
Set IBrokServers = IObjCreator.CreateObjAuth("MemAdmin.BrokServers")
call IBrokServers.MappedTo("W3SVC",3,MemId,MemComment)

'  MemId now has the Membership virtual server instance ID
wscript.echo "Configuring Membership Server named: " & MemComment

IBrokServers = Nothing '  release interface ref
IAuoConfig.GetInfo(MemId)

Name = "LDAP2"
AdsPathPrefix = "LDAP://server:1000/o=company/ou=members"
Class = "member"
Schema = "LDAP://server:1000/o=company/ou=admin/cn=schema/cn=member"
Suffix = 1 '  registered user names used for this instance
' this is the DN of the directory user and password to use when binding
' to all ADSI objects from this DS.  
BindAsName = "o=company/ou=membersh/cn=administrator"
BindAsPassword = "password"

Call IAuoConfig.SetEntry(Name,
                     AdsPathPrefix,
                     Class,
                     Schema,
                     Suffix,
                     "",   ' DepObject; not used here
                     "",   ' DepProp;  not used here
                     BindAsUsername,
                     BindAsPassword )
IAuoConfig.SetInfo
Set IAuoConfig = Nothing   ' release interface ref

Here's an ASP example that will list the Names (aliases) and Namespace (providers) for the AUO for a given Membership virtual server instance.

ASP and VBScript

<%
Set IObjCreator = Server.CreateObject("ObjCreator.ObjCreator.1")
Set IAuoConfig = IObjCreator.CreateObjAuth("MemAdmin.AuoConfig")

'  configure Membership virtual server that is mapped to IIS virtual server 3
Set IBrokServers = IObjCreator.CreateObjAuth("MemAdmin.BrokServers")
call IBrokServers.MappedTo("W3SVC",3,MemId,MemComment)

IAuoConfig.GetInfo MemId
IAuoConfig.GetEntries names,namespaces

Response.Write "The AUO entries for Membership Server " & MemId & "<br>"
Response.Write "Server Name: " & MemComment & "<br><br>"

For I = LBound(names) to UBound(names)
  if names(I) = "" Then
   names(I) = "Default"
  end if
  Response.write "Name: " & names(I) & "<br>"
  Response.write "Namespace: " & namespaces(I) & "<br><br>"
Next
%>

© 1997-1998 Microsoft Corporation. All rights reserved.