ASP.net Application using Impersonation

B

Buck

I have an application that is using impersonation and when I try to
launch an executable, the executable is started with the
NetworkService account used in the Application Pool identity. My
understanding is that it should launch using the logon account.
Windows 2003, IIS6.0, and ASP.NET 2.0.
 
J

Juan T. Llibre

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.
 
B

Buck

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()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top