Groups | Blog | Home
all groups > asp.net webservices > july 2003 >

asp.net webservices : How to impersonate the child process of a web service


Aadil Abbas
7/29/2003 2:26:43 PM
I am running a web service on IIS 6.0, impersonation is set to true, so my
web service can access resources depending on the client's privileges, but
when I launch a child process from the web service, this child process does
not inherit the security context of its parent (impersonated) thread. How
can I delegate this impersonation to the child process without making any
calls to unmanaged code like CreateProcess etc.

Here is my C# code, that is run from a web service, creates a child process
(a command shell) and tries to access a network resource. This child process
runs as
"NT Authority\Network Service" and therefore cannot access network
resources. I want to impersonate this child process, so it can access
network resources depending on the rights of client.

Process proc = new Process();
proc.StartInfo.FileName = "cmd";
proc.StartInfo.Arguments = "/k "+str+ " > h:\\temp\\log.txt";
proc.StartInfo.WorkingDirectory = @"h:\temp";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.Start();

Thanks
Aadil

Aadil Abbas
7/29/2003 2:54:57 PM
Thanks Bjoern, but I have already impersonated my ASP.NET application and it
can access Network Resources. The problem, that I am facing is with the
child process of this ASP.NET application. I spawn a new process from my web
service and this new process cannot inherit the security context of its
parent thread and therefore runs under the default identity of ASP.NET
application i.e Network Service account.

The code that I supplied, is used for the creation of a new process.

Thanks
Aadil

[quoted text, click to view]

Bjoern Wolfgardt
7/29/2003 8:34:41 PM
Hi,

I think this is what you are looking for :
http://support.microsoft.com/default.aspx?scid=kb;en-us;306158


cu
Bjoern Wolfgardt


"Aadil Abbas" <maa49@cornell.edu> schrieb im Newsbeitrag
news:Oqii37fVDHA.2004@TK2MSFTNGP10.phx.gbl...
[quoted text, click to view]

Bjoern Wolfgardt
7/30/2003 11:27:35 AM
Sorry,

but I allways come to the solution to use CreateProcessWithTokenW or
something like this. But this is allways unmanged code. I haven't found
another solution right now.
(http://groups.google.de/groups?hl=de&lr=&ie=UTF-8&oe=UTF-8&selm=ui3kgV1BCHA
..2428%40tkmsftngp02)

Hope you will find another solution.
Bjoern Wolfgardt


"Aadil Abbas" <maa49@cornell.edu> schrieb im Newsbeitrag
news:#SZKsLgVDHA.1912@TK2MSFTNGP11.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button