473,387 Members | 3,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

NetUserAdd +aspx

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.
Nov 18 '05 #1
2 1591
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
Nov 18 '05 #2
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!
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Gateway | last post by:
Hi, I'm logged into a stand alone laptop as administrator and running MSDE for SQL 7 as a silent install using the standard unattend.iss and the command options -a -SMS -f1 unattend.iss The...
3
by: Stevie_mac | last post by:
It might be me but... I dont seem to get a Page_Load event when a opening an ASPX in an iFrame. I do geta Page_Load event when an item on the ASPX (inside the iFrame) is clicked but then...
1
by: Jerry Tovar | last post by:
I am using .Net 2003 on a XPPro running IIS. I am unable to view any of my ASPX webforms in a browser unless I modify the .ASPX file and replace Codebehind="employee.aspx.cs" with...
3
by: Tom | last post by:
Hi, I have an index.aspx page which includes top.aspx, left.aspx, main.aspx and bottom.aspx. In the left.aspx, there is a login web control - login.ascx. It keeps session of username and role...
6
by: John Lau | last post by:
Hi, I am looking at the MS KB Article 306355: HOW TO: Create Custom Error Reporting Pages in ASP.NET by Using Visual C# .NET This article describes how to redirect errors to a custom html...
3
by: DavidS | last post by:
Have parent.aspx from which I open Driver.aspx form via button on parent.aspx. When I first open the modal dialog, the driver.aspx Page_Load function is called. After I close the dialog, then...
3
by: Evan | last post by:
I have a web page with 2 frames. The left frame is running menu.aspx and the right frame is running images.aspx. When a selection is made in menu.aspx I call a method in images.aspx and pass a...
10
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and...
24
by: John Rivers | last post by:
ASPX which means ASPX pages, the code-behind concept, User Controls, Web Controls etc. is very poorly designed and makes it extremely hard to develop professional quality web applications. ASPX...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.