Create new user using IIS/ASP

Discussion in 'ASP General' started by Ohaya, Nov 14, 2003.

  1. Ohaya

    Ohaya Guest

    Hi,

    I'm running IIS5 on a Win2K server, and I want to have an ASP page that
    creates new users. I have some simple code to test this, but am getting
    a "500" error when I run it.

    The ASP looks like:

    <%

    strDomain ="Foo.com"
    strUser ="Foo1"

    ' Create new user with password
    Set oDomain = GetObject("WinNT://" & strDomain)
    Set oUser = oDomain.Create ("User", strUser)
    oUser.SetPassword = "password"
    oUser.SetInfo
    %>

    Just for this testing, I've added IUSR_machinename to the Administrators
    group, but am still getting the 500 error.

    Can anyone tell me what I'm doing wrong here???

    Thanks in advance!!
     
    Ohaya, Nov 14, 2003
    #1
    1. Advertisements

  2. Ohaya

    Ray at Guest

    Try using:

    oUser.SetPassword "password"

    ..SetPassword is a method that requires an argument. You're trying to treat
    it as a property. That's my interpretation, anyway!

    Also, http://www.aspfaq.com/2109

    Ray at work

    "Ohaya" <ohaya@NO_SPAM.cox.net> wrote in message
    news:3FB51ABA.29565DFA@NO_SPAM.cox.net...
    > Hi,
    >
    > I'm running IIS5 on a Win2K server, and I want to have an ASP page that
    > creates new users. I have some simple code to test this, but am getting
    > a "500" error when I run it.
    >
    > The ASP looks like:
    >
    > <%
    >
    > strDomain ="Foo.com"
    > strUser ="Foo1"
    >
    > ' Create new user with password
    > Set oDomain = GetObject("WinNT://" & strDomain)
    > Set oUser = oDomain.Create ("User", strUser)
    > oUser.SetPassword = "password"
    > oUser.SetInfo
    > %>
    >
    > Just for this testing, I've added IUSR_machinename to the Administrators
    > group, but am still getting the 500 error.
    >
    > Can anyone tell me what I'm doing wrong here???
    >
    > Thanks in advance!!
     
    Ray at, Nov 14, 2003
    #2
    1. Advertisements

  3. Ohaya

    Ohaya Guest

    Ray,

    HOORAY!!!! That worked great!!

    Thanks a lot!

    (Did I include enough exclamation points in this post :)?)

    Jim



    "Ray at <%=sLocation%>" wrote:
    >
    > Try using:
    >
    > oUser.SetPassword "password"
    >
    > .SetPassword is a method that requires an argument. You're trying to treat
    > it as a property. That's my interpretation, anyway!
    >
    > Also, http://www.aspfaq.com/2109
    >
    > Ray at work
    >
    > "Ohaya" <ohaya@NO_SPAM.cox.net> wrote in message
    > news:3FB51ABA.29565DFA@NO_SPAM.cox.net...
    > > Hi,
    > >
    > > I'm running IIS5 on a Win2K server, and I want to have an ASP page that
    > > creates new users. I have some simple code to test this, but am getting
    > > a "500" error when I run it.
    > >
    > > The ASP looks like:
    > >
    > > <%
    > >
    > > strDomain ="Foo.com"
    > > strUser ="Foo1"
    > >
    > > ' Create new user with password
    > > Set oDomain = GetObject("WinNT://" & strDomain)
    > > Set oUser = oDomain.Create ("User", strUser)
    > > oUser.SetPassword = "password"
    > > oUser.SetInfo
    > > %>
    > >
    > > Just for this testing, I've added IUSR_machinename to the Administrators
    > > group, but am still getting the 500 error.
    > >
    > > Can anyone tell me what I'm doing wrong here???
    > >
    > > Thanks in advance!!
     
    Ohaya, Nov 14, 2003
    #3
    1. Advertisements

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. lewi
    Replies:
    0
    Views:
    446
  2. =?Utf-8?B?Tm92aWNl?=
    Replies:
    2
    Views:
    6,917
    Alan Ferrandiz Langley
    Jun 9, 2004
  3. Brad Rogers
    Replies:
    5
    Views:
    548
    Brad Rogers
    Dec 25, 2005
  4. Jon Davis
    Replies:
    3
    Views:
    794
    Jon Davis
    Jun 21, 2007
  5. prady
    Replies:
    2
    Views:
    581
    Phil H
    Dec 29, 2007
  6. Dominick Baier [DevelopMentor]

    Need help on Create New User account in asp.net 2.0

    Dominick Baier [DevelopMentor], Apr 5, 2006, in forum: ASP .Net Security
    Replies:
    6
    Views:
    333
    Learner
    Apr 6, 2006
  7. Guennadi V. Vanine
    Replies:
    0
    Views:
    480
    Guennadi V. Vanine
    Aug 21, 2003
  8. Replies:
    2
    Views:
    795
    Thomas 'PointedEars' Lahn
    Mar 11, 2008
Loading...