NetUserAdd +aspx

Discussion in 'ASP .Net' started by Kjartan, Dec 2, 2003.

  1. Kjartan

    Kjartan Guest

    Hi.

    I created a program which creates a user on my machine using
    NetApi32.dll or more specifically NetUserAdd. The program runs fine
    and a user is created on my machine (I used C#). Now I want to create
    a user on my machine using aspx. Is this possible? I used the same
    code I used in my C# program but I'm never able to create a user, is
    this a permissions problem or something else??

    I would much appreciate any help given.

    Best regards,
    Kjartan.
     
    Kjartan, Dec 2, 2003
    #1
    1. Advertising

  2. Kjartan

    Eric Veltman Guest

    Kjartan wrote:

    > I created a program which creates a user on my machine using
    > NetApi32.dll or more specifically NetUserAdd. The program runs fine
    > and a user is created on my machine (I used C#). Now I want to create
    > a user on my machine using aspx. Is this possible? I used the same
    > code I used in my C# program but I'm never able to create a user, is
    > this a permissions problem or something else??


    Hello Kjartan,

    It is possible. Some months ago I wrote an application in ASP.NET
    that contained administration pages that, amongst other things,
    added users to local groups on the webserver machine.
    I used ADSI to do this, but I guess using NetApi32
    to add local users should work as well.

    The important thing to ensure is that your code runs as a user
    who is permitted to do this operation on the web server machine.
    I think by default it runs as ASPNET, so probably you'll have
    to change some settings. I'll describe the way I did this,
    but keep in mind that I used Windows integrated security everywhere
    and that will only work on intranet/extranet, don't know how to
    achieve this with f.i. forms authentication.

    1. In IIS, you need to disable anonymous access to the
    folder/page and enable Windows integrated security.
    This only works with intranet.

    2. For ASP.NET, you need to enable impersonation in web.config.

    Then the code on the web server should run with
    the privileges of the user behind the web browser.

    Best regards,

    Eric Veltman
     
    Eric Veltman, Dec 2, 2003
    #2
    1. Advertising

  3. Thanks a lot for your swift reply. I tried your advice and everything
    is working great.

    Best Wishes,

    Kjartan.



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Kjartan Arsaelsson, Dec 2, 2003
    #3
    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. Gerry O'Brien [MVP]
    Replies:
    0
    Views:
    515
    Gerry O'Brien [MVP]
    Apr 11, 2004
  2. vish
    Replies:
    2
    Views:
    1,748
    Steve C. Orr, MCSD
    Jul 16, 2003
  3. Jerry Tovar
    Replies:
    1
    Views:
    2,748
    Jim Cheshire [MSFT]
    Oct 23, 2003
  4. Sriram Mallajyosula

    How do I post data from aspx page to another aspx page.

    Sriram Mallajyosula, Nov 5, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,012
    Steve C. Orr [MVP, MCSD]
    Nov 5, 2003
  5. John M
    Replies:
    1
    Views:
    1,239
    Kumar Reddi
    May 29, 2005
Loading...

Share This Page