Running process under another user account
C#
1
Posts
1
Posters
0
Views
1
Watching
-
Hi, I'm trying to run another app from my C# code, under the context of another user. I've been round the web and got the following code from MSDN:
ProcessStartInfo psi = new ProcessStartInfo(@"C:\Windows\Explorer.exe");//args[0]);
psi.UseShellExecute = false;psi.Domain = userParts[0];
psi.UserName = userParts[1];
psi.Password = password;Process.Start(psi);
Which i believe is fine - username and pwd are set correctly and are for a user that i can use to login to our domain. However, i keep getting an error that i have 'unknown username or bad password' - I am connecting from home at the minute over our VPN connection, and i'm wondering if that maybe has something to do with it... Wondering if anybody has seen something similar?