How to impersonate the child process of an ASP.NET application

From: Aadil Abbas (maa49_at_cornell.edu)
Date: 07/29/03


Date: Tue, 29 Jul 2003 14:29:18 -0400


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



Relevant Pages

  • Re: ASPNET and Impersonation
    ... > not through any additional configuration using the ... > file (instead of being localized to the single Web Service ... > using Impersonation or changing the process identity, ...
    (microsoft.public.dotnet.security)
  • Re: ASPNET and Impersonation
    ... > not through any additional configuration using the ... > file (instead of being localized to the single Web Service ... > using Impersonation or changing the process identity, ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Windows authentication for web service client??
    ... I have a web service that make a webDav request to Exchange. ... I have impersonation on but when I use the defaultCredentials in the web ... credentials have rights to make this request and I'm at my wits end trying ... >>> The ASPNET account is a local account, so the other machine or domain ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Can it work...? - ASP.NET Impersonation with Remoting
    ... I have an ASP.NET Web Page / Web Service that runs on IIS and uses ... Server expects a Principal token not a cheapo Impersonation token ... request it do the work (The Service will check the credentials and ...
    (microsoft.public.dotnet.framework.remoting)