Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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".

like image 422
Pritam Karmakar Avatar asked Oct 12 '22 01:10

Pritam Karmakar


1 Answers

Thanks everyone for your reply. Here I got the solution and now my process start with impersonated user.

https://learn.microsoft.com/en-US/troubleshoot/aspnet/spawn-process-under-impersonated-user

Thanks.

like image 57
Pritam Karmakar Avatar answered Oct 21 '22 04:10

Pritam Karmakar