I have a problem running processes in a transformed context in ASP.NET 2.0.
I am starting a new process in my web service code. IIS 5.1, .NET 2.0
[WebMethod] public string HelloWorld() { string path = @"C:\KB\GetWindowUser.exe"; ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.WorkingDirectory = Path.GetDirectoryName(path); startInfo.FileName = path; startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; startInfo.ErrorDialog = false; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; Process docCreateProcess = Process.Start(startInfo); string errors = docCreateProcess.StandardError.ReadToEnd(); string output = docCreateProcess.StandardOutput.ReadToEnd(); }
"C: \ KB \ GetWindowUser.exe" is a console application containing the following code:
static void Main(string[] args) { Console.WriteLine("Windows: " + WindowsIdentity.GetCurrent().Name); }
When I call a web service without impersonation, everything works fine.
When I turn on impersonation, the following error is written to the "errors" variable in the web service code:
Unhandled exception: System.Security.SecurityException: access denied. \ r \ n \ r \ n in System.Security.Principal.WindowsIdentity.GetCurrentInternal (TokenAccessLevels wishAccess, Boolean threadOnly) \ r \ n in System.Security. Principal.WindowsIdentity.GetCurrent () \ r \ n in ObfuscatedMdc.Program.Main (String [] args) \ r \ nConfiguring a failed assembly: \ r \ nMyComputer
The outstanding user is the local administrator and has access to the executable C: \ KB \ GetWindowUser.exe.
When I specify the user of the window explicitly in the properties of the ProcesStartInfo Domain, User and Password, I received the following message: http://img201.imageshack.us/img201/5870/pstartah8.jpg
Is it possible to start a process with different credentials than ASPNET from asp.net (IIS 5.1)?
marc
source share