ADSI - Trying to enable a user - the user add works very well

Discussion in 'ASP General' started by Jeremie Legault, Nov 23, 2005.

  1. Hi,

    I have written an ASP.NET 2.0 application that uses Active Directory or ADAM
    to manage account users - the site has a page that allows people to create an
    account (much like any site). The page populates the AD with all the
    information and the user account but I am unable to enable the account.
    Microsoft has information on how to do that here -->
    http://msdn.microsoft.com/library/d...us/ad/ad/example_code_for_creating_a_user.asp
    (the sample is for Visual Basic) - and I am unable to complete the bottom
    portion of the script. Can some one point me in the right direction - or can
    you tell me how I can add a snippet of VBscript code to an ASP.NET page.

    I am using the Active DS Type library - not sure why there are multiple ones
    (System.DirectoryServices) but it is rather confusing - I seem to accomplish
    one thing with one and another with the other (they did have trouble
    co-existing however). Anyway my script works very well but I am not able to
    access the properties required to enable the account.

    Here is a simple version (no error checking) of the code
    Sub BTSub_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim objUsers As ActiveDs.IADsContainer
    Dim objNewUser As ActiveDs.IADsUser
    objUsers = GetObject("LDAP://OU=Pickupfootball,DC=systemfix,DC=ca")
    objNewUser = objUsers.Create("user", "CN=" & txtFName.Text &
    txtLName.Text)
    objNewUser.Put("sAMAccountName", txtFName.Text & txtLName.Text)
    objNewUser.Put("givenName", txtFName.Text)
    objNewUser.Put("sn", txtLName.Text)
    objNewUser.Put("streetAddress", txtEADDR.Text)
    objNewUser.Put("mail", txtEADDR.Text)
    objNewUser.Put("title", txtOCC.Text)
    objNewUser.Put("displayName", txtFName.Text & "." & txtLName.Text)
    objNewUser.Put("description", GNDList.Text & ";" & txtAge.Text)
    objNewUser.SetInfo()
    objNewUser.ChangePassword("", "j1r1mi1")

    End Sub
    Thanks
    Jeremie Legault
    Jeremie Legault, Nov 23, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Raymond Arthur St. Marie II of III

    very Very VERY dumb Question About The new Set( ) 's

    Raymond Arthur St. Marie II of III, Jul 23, 2003, in forum: Python
    Replies:
    4
    Views:
    449
    Raymond Hettinger
    Jul 27, 2003
  2. shanx__=|;-

    very very very long integer

    shanx__=|;-, Oct 16, 2004, in forum: C Programming
    Replies:
    19
    Views:
    1,589
    Merrill & Michele
    Oct 19, 2004
  3. Abhishek Jha

    very very very long integer

    Abhishek Jha, Oct 16, 2004, in forum: C Programming
    Replies:
    4
    Views:
    407
    jacob navia
    Oct 17, 2004
  4. Peter

    Very very very basic question

    Peter, Feb 8, 2005, in forum: C Programming
    Replies:
    14
    Views:
    495
    Dave Thompson
    Feb 14, 2005
  5. olivier.melcher

    Help running a very very very simple code

    olivier.melcher, May 12, 2008, in forum: Java
    Replies:
    8
    Views:
    2,244
Loading...

Share This Page