By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,159 Members | 1,941 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,159 IT Pros & Developers. It's quick & easy.

Starting a new Process under a Specified Windows Account

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.