S
shellyshao
Hi, I have an ASP.NET web application running with following code:
System.Diagnostics.Process runner = new System.Diagnostics.Process();
runner.StartInfo.FileName = "fc.exe";
runner.StartInfo.Arguments = strFile1 + " " + strFile2;
runner.StartInfo.WorkingDirectory = strFileRoot;
runner.StartInfo.UseShellExecute = false;
runner.StartInfo.RedirectStandardOutput = true;
runner.StartInfo.RedirectStandardError=true;
runner.Start();
StreamWriter sw = new StreamWriter(strFileRoot+
"\\diff.txt",false);
string strDiff = runner.StandardOutput.ReadToEnd();
thisPage.Trace.Write("running under:"+ Environment.UserName);
thisPage.Trace.Write("running
under:"+System.Security.Principal.WindowsIdentity.GetCurrent().Name);
thisPage.Trace.Write("fc.exe "+strFile1+"
"+strFile2+":"+strFileRoot+":"+runner.StandardError.ReadToEnd() +
":"+strDiff);
sw.Write(strDiff);
sw.Close();
runner.WaitForExit();
runner.Close();
It works fine on my windows XP + SP2 machine. However, on a windows
2003 server, strDiff is always empty and starndarderror is also empty.
I do notice it runs as aspnet on windows xp, but as network service
acount on 2003. So I impersonated to a domain account and also added
that domain account to admin groups on the windows 2003 machine, but
still strDiff returns empty. Please please please help.
Haiping
System.Diagnostics.Process runner = new System.Diagnostics.Process();
runner.StartInfo.FileName = "fc.exe";
runner.StartInfo.Arguments = strFile1 + " " + strFile2;
runner.StartInfo.WorkingDirectory = strFileRoot;
runner.StartInfo.UseShellExecute = false;
runner.StartInfo.RedirectStandardOutput = true;
runner.StartInfo.RedirectStandardError=true;
runner.Start();
StreamWriter sw = new StreamWriter(strFileRoot+
"\\diff.txt",false);
string strDiff = runner.StandardOutput.ReadToEnd();
thisPage.Trace.Write("running under:"+ Environment.UserName);
thisPage.Trace.Write("running
under:"+System.Security.Principal.WindowsIdentity.GetCurrent().Name);
thisPage.Trace.Write("fc.exe "+strFile1+"
"+strFile2+":"+strFileRoot+":"+runner.StandardError.ReadToEnd() +
":"+strDiff);
sw.Write(strDiff);
sw.Close();
runner.WaitForExit();
runner.Close();
It works fine on my windows XP + SP2 machine. However, on a windows
2003 server, strDiff is always empty and starndarderror is also empty.
I do notice it runs as aspnet on windows xp, but as network service
acount on 2003. So I impersonated to a domain account and also added
that domain account to admin groups on the windows 2003 machine, but
still strDiff returns empty. Please please please help.
Haiping