I have service running in self hosting application. When request comes, I want to start a process as a user, from which the request had come from. In the example below, first message box shows User1 name, second User2, but the notepad runs as User1. how can I force it to start as User2?
MessageBox.Show(WindowsIdentity.GetCurrent().Name);
using (((WindowsIdentity)RequestContext.Principal.Identity).Impersonate())
{
MessageBox.Show(WindowsIdentity.GetCurrent().Name);
Process.Start("Notepad.exe");
}