473,416 Members | 1,570 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,416 software developers and data experts.

Starting a new Process under a Specified Windows Account

One of our ASP.NET Pages is starting a new Process using the Process object.
When the process starts, it is started under the ASPNET User. We tried
editing the web.config file and the machine.config to operate under other
user accounts but our dynamically started process still starts under ASPNET.
How do you programatically start a process under a specific Windows User
Account? Thanks so much!

Christopher
Nov 19 '05 #1
3 1928
One option is to impersonate your application to run under that windows
account and then start the process. To know about impersonation, check out
this article.
http://support.microsoft.com/default...b;en-us;306158

--
-Saravana
http://dotnetjunkies.com/WebLog/saravana/
www.ExtremeExperts.com

"Christopher" <Ch*********@discussions.microsoft.com> wrote in message
news:A0**********************************@microsof t.com...
One of our ASP.NET Pages is starting a new Process using the Process object. When the process starts, it is started under the ASPNET User. We tried
editing the web.config file and the machine.config to operate under other
user accounts but our dynamically started process still starts under ASPNET. How do you programatically start a process under a specific Windows User
Account? Thanks so much!

Christopher

Nov 19 '05 #2
Hi Christopher:

Did you change the processModel in web.config and verify the worker process
launches under the newly specified account? Any process spawned will inherit
the identity of the parent process with the Process class in .NET 1.x.

Outside of this approach, you'll need to PInvoke CreateProcessAsUser, CreateProcessWithLogonW,
or CreateProcessWithTokenW. It's easier and more secure to use the above
method, however.
--
Scott
http://www.OdeToCode.com/blogs/scott/
One of our ASP.NET Pages is starting a new Process using the Process
object. When the process starts, it is started under the ASPNET User.
We tried editing the web.config file and the machine.config to operate
under other user accounts but our dynamically started process still
starts under ASPNET. How do you programatically start a process under
a specific Windows User Account? Thanks so much!

Christopher

Nov 19 '05 #3
Unfortunately, impersonation doesn't help when creating a new process.

A new process always inherits the security context of the parent process,
even if the thread starting the child process is impersonating. The only
way to create a child process under a different account (in 1.x) is to PInvoke
one of the CreateProcessWith* APIs.

In 2.0 you can add credentials to the Process class (but this assumes you'll
have the user's password - ugh).

--
Scott
http://www.OdeToCode.com/blogs/scott/
One option is to impersonate your application to run under that
windows account and then start the process. To know about
impersonation, check out this article.
http://support.microsoft.com/default...b;en-us;306158

"Christopher" <Ch*********@discussions.microsoft.com> wrote in message
news:A0**********************************@microsof t.com...
One of our ASP.NET Pages is starting a new Process using the Process

object.
When the process starts, it is started under the ASPNET User. We
tried editing the web.config file and the machine.config to operate
under other user accounts but our dynamically started process still
starts under

ASPNET.
How do you programatically start a process under a specific Windows
User Account? Thanks so much!

Christopher

Nov 19 '05 #4

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

Similar topics

9
by: Matt Calhoon | last post by:
Hi there, I have specified a aspnet user account to run all .net sites. This account needs access to start a .BAT File (in my global.asax on session start the app needs to execute this bat...
2
by: DanP | last post by:
I have intranet web app that I'm trying to execute a exe using Process.Start. I get "Logon failure: unknown user name or bad password ". The exe is a simple vb6 app that prints a Crystal report....
4
by: Kristof Despiere | last post by:
Suppose you have one domain, filled with a couple of users. What needs to be done now is I need to start a windows application from a webform by pressing a button on the webform (for example). ...
3
by: Jørn A. | last post by:
I'm working on a web based user interface for a job scheduling system (running scripts). The system is using a non-windows scheduler software, but it's installed and running as a windows...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
1
by: Qais | last post by:
Hi there all, i am trying to work on this for past two weeks but nothing seem to work. I am trying to launch a process from windows service (i have to do this way, no other option). Windows...
6
by: ludwig.stuyck | last post by:
Hi all, I need to start an executable from within a windows service. I tried the following code in the windows service: ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName =...
4
by: DubSport | last post by:
I am trying to get my .net page to run a simple batch file on my IIS server. I want it to run with specified credentials. It appears to start the program cmd.exe as the correct user (shows up in...
8
by: Okonita | last post by:
Hi all, I have gone through the process of installing DB2 UDBv9 Express-C in my local linux environment. I am used to having icon placed on my Desktop or taskbar for easy access to (db2cc)...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.