K
Kristof Despiere
Suppose you have one domain, filled with a couple of users. What needs to be
done now is I need to start a windows application from a webform by pressing
a button on the webform (for example).
The problem is that the user who "owns" the service is always the ASPNET
account. That's not good since you don't see the actual application (because
it's owned by ASPNET). I've tried changed the processmodel section in the
machine.config file to "SYSTEM" instead of "MACHINE" but that didn't work.
It was the same thing except the process owner was now "SYSTEM" and should
be my logged on (authenticated) user. The reason why that is needed is
because the application detects the current users login and compares that
with the membership of a certain group.
My next step was to try impersonation, but that doesn't work yet. See
snippet of code below. I don't know what i do wrong but i keeps functioning
as the ASPNET account. I also tried giving the ASPNET account the rights of
("Act as a part of the operating system") but that does nothing again. What
am i missing here. Ah, in the web.conf impersonation is set to true but
still doesn't work.
Help would be strongly appreciated.
Kristof
System.Security.Principal.WindowsImpersonationContext impersonationContext;
impersonationContext =
((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate();
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = "test.exe";
myProcess.StartInfo.WorkingDirectory = @"D:\test";
myProcess.Start();
impersonationContext.Undo();
done now is I need to start a windows application from a webform by pressing
a button on the webform (for example).
The problem is that the user who "owns" the service is always the ASPNET
account. That's not good since you don't see the actual application (because
it's owned by ASPNET). I've tried changed the processmodel section in the
machine.config file to "SYSTEM" instead of "MACHINE" but that didn't work.
It was the same thing except the process owner was now "SYSTEM" and should
be my logged on (authenticated) user. The reason why that is needed is
because the application detects the current users login and compares that
with the membership of a certain group.
My next step was to try impersonation, but that doesn't work yet. See
snippet of code below. I don't know what i do wrong but i keeps functioning
as the ASPNET account. I also tried giving the ASPNET account the rights of
("Act as a part of the operating system") but that does nothing again. What
am i missing here. Ah, in the web.conf impersonation is set to true but
still doesn't work.
Help would be strongly appreciated.
Kristof
System.Security.Principal.WindowsImpersonationContext impersonationContext;
impersonationContext =
((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate();
System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
myProcess.StartInfo.FileName = "test.exe";
myProcess.StartInfo.WorkingDirectory = @"D:\test";
myProcess.Start();
impersonationContext.Undo();