How to start a IIS process with specific username & password

I'm trying to run an application from our internal website. When I use Process.Start("notepad"); I can see that notepad process started in our web server with default identity mentioned in the app pool setting.

But I have to start the process with specific user name & password. So I have tried to run this line of code

string password = "XXXXX";
System.Security.SecureString securePwd = new System.Security.SecureString();
foreach (char c in password)
{
    // Append the character to the password.
    securePwd.AppendChar(c);
}
Process.Start("notepad", "username", securePwd, "domain");

In this case I don't even see any notepad process started in the web server. The lines of code executing because when I pass wrong password I can see my webpage throwing error of "bad username or password".

5
задан Mo Patel 6 June 2013 в 10:55
поделиться