Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > NetUserAdd +aspx

Reply
Thread Tools

NetUserAdd +aspx

 
 
Kjartan
Guest
Posts: n/a
 
      12-02-2003
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.
 
Reply With Quote
 
 
 
 
Eric Veltman
Guest
Posts: n/a
 
      12-02-2003
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
 
Reply With Quote
 
 
 
 
Kjartan Arsaelsson
Guest
Posts: n/a
 
      12-02-2003
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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments