abbiamo proseguito nel nostro intento di lanciare un .bat da pagina asp.net .
utilizzando imporsonate e l'utente di root per il momento non restituisce più access denied.
al momento però non esegue correttamente il file bat , ritornando come errore il seguente :
exitcode = 1, abbiamo provato con un bat file contenente il seguente comando :
dir *.* >pippo.txt
che ovviamente se lanciato da command line restituisce un file di testo contenente la dir, se lanciato da pagina da c# restituisce cmq exitcode=1. La chiamata che abbiamo provato è la seguente :
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("d:\\fop-0.94\\xxx.bat");
psi.RedirectStandardOutput =
true;psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
psi.UseShellExecute =
false;System.Diagnostics.Process listFiles;
listFiles = System.Diagnostics.
Process.Start(psi);System.IO.StreamReader myOutput = listFiles.StandardOutput;
listFiles.WaitForExit(2000);
if (listFiles.HasExited)
{
string output = myOutput.ReadToEnd();throw (new Exception(" errore:" + output + " - " + listFiles.ExitCode.ToString()));
}