Under ASP.NET 1.1, running "any.exe" using
Process.Start will always run as the ASP.NET account.
Fortunately, under 2.0, provided you take the necessary steps,
you can run an executable via any account, and even return to
continue executing ASP.NET under your usual account.
See:
http://www.codinghorror.com/blog/archives/000133.html
There's very specific instructions/links there
which will allow you to do what you want to do.
Juan T. Llibre, asp.net MVP
asp.net faq :
http://asp.net.do/faq/
foros de asp.net, en español :
http://asp.net.do/foros/
- Show quoted text -
When I run this on my my Windows XP machine, Notepad will start and
run under the username supplied.
Moved application to Windows 2003 and I get the Access denied error. I
can launch notepad as
the user supplied on the W2K3 machine using run as. It still appears
to me that the process is trying to launch as Network Service????/
I
Dim ArgString, pwd As String
Dim Program As New Process
Program.StartInfo.UserName = "********"
Program.StartInfo.Domain = "*******"
Dim f As SecureString
f = Nothing
f = New SecureString
Dim b As Char
pwd = "12345"
For Each b In pwd.ToCharArray()
f.AppendChar(b)
Next b
Program.StartInfo.Password = f
ID =
System.Security.Principal.WindowsIdentity.GetCurrent().Name
Program.StartInfo.UseShellExecute = False
Program.StartInfo.FileName = "notepad.exe "
Program.StartInfo.RedirectStandardOutput = True
Program.StartInfo.RedirectStandardError = True
Program.Start()
Program.StandardOutput.ReadToEnd()
Program.WaitForExit(5000)
Program.Close()