467,076 Members | 852 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,076 developers. It's quick & easy.

Process.Start with UserName/Password gives Access is Denied

The following C# web service works fine until you uncomment the lines
setting UserName and Password. Then, Process.Start throws an
Access is Denied Exception. This is with .NET 2.0, of
course (1.1 does not support running a process as a different user).
I'm running everything on Windows Server 2003. I have impersonation
in my web.config, and I'm using Integrated authentication on the IIS
directory that this aspx is in. When I invoke the service via the
aspx browser, I connect as a domain user.

I understand that IIS runs as Local System, and I cannot start a
as a different user like this from Local System. So I put this Web
Service into an IIS Application Pool with the Identity set to the local
Administrator account. I also added local Admin to the IIS_WPG group
granted access to "Adjust memory quotas for a process" and "Replace a
process level token". Despite all this, it still tells me "Access is
when I try to start the process with ProcessStartInfo.UserName set.
Even if,
as the code below shows, I try to start with with the name and password
of the
local Adminstrator (the same account the pool is configured to use

Just to clarify, if I invoke without UserName set, the process runs
fine and
whoami tells me it is the local Administrator as expected. What other
do I need to grant local Administrator to allow it to create this
process as
a different user?

<%@ WebService Language="C#" Class="Kirk.ForkIt" %>

using System;
using System.IO;
using System.Collections;
using System.Security;
using System.Web.Services;
using System.Diagnostics;

namespace Kirk
public class ForkIt
public string Main()
Process p = new Process();
ProcessStartInfo pInfo = new
ProcessStartInfo(@"c:\windows\system32\whoami.exe" );

SecureString password = new SecureString();
// set value for password here.

//pInfo.UserName = "Administrator";
//pInfo.Password = password;
pInfo.CreateNoWindow = true;
pInfo.UseShellExecute = false;
pInfo.RedirectStandardOutput = true;

p.StartInfo = pInfo;

String output = p.StandardOutput.ReadToEnd();

return output;

Feb 9 '06 #1
  • viewed: 5734

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Mark | last post: by
11 posts views Thread by Kirk | last post: by
6 posts views Thread by Alexander Widera | last post: by
6 posts views Thread by bill@abc.com | last post: by
3 posts views Thread by SugarDaddy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.