i'm trying to execute vbscript from c#, the vbscript runs always succesfully despite of the fact that i don't have permissions to run this script.
the code:
//nswp is the User's password
foreach (char c in uspw)
{
password.AppendChar(c);
}
Process scriptProc = new Process();
scriptProc.StartInfo.RedirectStandardOutput = true;
scriptProc.StartInfo.RedirectStandardError = true;
scriptProc.StartInfo.Domain = "moia.gov.il";
scriptProc.StartInfo.ErrorDialog = true;
scriptProc.StartInfo.UserName = Globals.CURRENT_USER.user_name;
scriptProc.StartInfo.Password = password;
scriptProc.StartInfo.UseShellExecute = false;
scriptProc.StartInfo.FileName = @"cscript";
scriptProc.StartInfo.Arguments = "//B //Nologo " + pathSave;
scriptProc.Start();
scriptProc.WaitForExit();
scriptProc.Close();
When i'm executing this vbscript manually (by double click on the file icon) i get a permissions error, as i should.
How can i catch this error in c# and throw exception respectively.