Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Run process as another user

Reply
Thread Tools

Run process as another user

 
 
Sorin Dolha [MCSD .NET]
Guest
Posts: n/a
 
      03-01-2004
That's ok with me, I just wanted to explained to Krishnan why I couldn't use his or her solution.

--
Sorin Dolha [MCAD, MCSD .NET]
"Willy Denoyette [MVP]" <> wrote in message news:edw0An6$...

"Sorin Dolha [MCSD .NET]" <> wrote in message news:eWF7TZ6$...
Krishnan,

I've looked into the MSDN sample code for Impersonation and I wanted to state that I have already tried code impersonating (I've already saw and tested this sample code), but this code only sets up a new user for currently executing code in the current process only (for example, if the code in the process tries to access a file, the user who is accessing the file is the impersonated user). However, if I try to start a new process using Process.Start() from inside the code, during active impersonation, the external process does not start as running on the impersonated user, but instead is run under the same account which originally started the sample code. Therefore, I think that this is not the correct solution for my problem.

To better visualize why this code doesn't solve my problem, I'll provide a step-by-step execution diagram below:
a.. User1 starts sample code process
b.. Sample code process is impersonated to User2
c.. Sample code process can access a file as it would be User2
d.. Sample code process uses Process.Start() to run a second process while it still is impersonated to User2: however, second process starts under User1!
This behavior is by design, the child process takes the calling process token, not the impersonation token of the calling thread, or in other words, the new process runs in the security context of the calling process.

Willy.

 
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run a python script as an exe and run a new process from it venutaurus539@gmail.com Python 9 02-27-2009 05:22 PM
Process Cannot access file "file_name" because it is being used by another process Rithesh Pai ASP .Net 1 08-22-2005 03:02 PM
The process cannot access the file because it is being used by another process Ponnurangam ASP .Net 1 10-20-2004 05:54 PM
How to access: a page from a User control, and another User controlfrom another one? qwerty ASP .Net 3 09-30-2004 05:32 PM
The process cannot access the file because it is being used by another process. Jerry ASP .Net 4 12-15-2003 06:07 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57