Archive for June, 2009

Run External Application as Another User in C#

Thursday, June 4th, 2009

An arbitrary external application can be executed from C# using System.Diagnostics.Process. If you want to run as another user, setting the System.Diagnostics.Process.StartInfo.Password field can be a bit confusing. Here is one way using System.Security.SecureString.AppendChar to avoid having to resort to unsafe code: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CSRunAs { ...