I am trying to delete and rebuild an encrypted password file. I am able to create the file and add usernames and encrypted passwords if I run the commands manually on the server within a command window. But I get nothing if I try to run this code from within my C# web api controller. The delete line works, but the first Process.Start line fails, and it never makes it to my while loop.
System.IO.StreamReader pass2 = new System.IO.StreamReader(pass);
File.Delete("C:\\inetpub\\wwwroot\\password\passMD5.txt");
Process.Start("C:\\inetpub\\htpasswd.exe -bc C:\\inetpub\\wwwroot\\password\\passMD5.txt sm88555 sm88999");
while ((line = pass2.ReadLine()) != null)
{
un = line.Substring(0, 6);
pw = line.Substring(7, 6);
Process.Start("C:\\inetpub\\htpasswd.exe -b C:\\inetpub\\wwwroot\\password\\passMD5.txt " + un + " " + pw);
}
pass2.Close();