H
Heiko Besemann
Dear group,
I created an aspx page using System.Diagnostics.Process() to launch
"tracert" from shell and redirect output to Response.Output which
prints it as text/plain into my browsers window. Now that works fine
so far. My problem is that while tracert process is running and ASP
..NET is putting data into the pages output stream, my webapplication
is locked until tracert process exits. How can I stop locking my
application and be able to display other aspx pages while tracert is
running?
Thanks for your help!
Heiko Besemann
Here is my example code...
-- snip --
private System.Diagnostics.Process p;
private void Page_Load(object sender, System.EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Parse("1.2.1973 07:00:00"));
Page.Response.Clear();
Page.Response.ContentType = "text/plain";
Response.AppendHeader("Content-Disposition","filename=\"traceroute.txt\"");
Response.BufferOutput = false;
Page.Response.Output.Write("TraceRoute bearbeitet Anfrage -- bitte
warten!\n\n");
Page.Response.Flush();
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "c:\\windows\\system32\\tracert";
p.StartInfo.Arguments = Request.Params["ip"]; //"217.88.223.186";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
p.PriorityClass = System.Diagnostics.ProcessPriorityClass.Normal;
while (!p.HasExited)
{
strTemp = p.StandardOutput.ReadLine();
if(strTemp.Length > 3) Page.Response.Output.Write(strTemp+"\n");
Page.Response.Flush();
if(!Response.IsClientConnected)
{
p.Kill();
break;
}
}
Response.Flush();
Response.Close();
}
I created an aspx page using System.Diagnostics.Process() to launch
"tracert" from shell and redirect output to Response.Output which
prints it as text/plain into my browsers window. Now that works fine
so far. My problem is that while tracert process is running and ASP
..NET is putting data into the pages output stream, my webapplication
is locked until tracert process exits. How can I stop locking my
application and be able to display other aspx pages while tracert is
running?
Thanks for your help!
Heiko Besemann
Here is my example code...
-- snip --
private System.Diagnostics.Process p;
private void Page_Load(object sender, System.EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Parse("1.2.1973 07:00:00"));
Page.Response.Clear();
Page.Response.ContentType = "text/plain";
Response.AppendHeader("Content-Disposition","filename=\"traceroute.txt\"");
Response.BufferOutput = false;
Page.Response.Output.Write("TraceRoute bearbeitet Anfrage -- bitte
warten!\n\n");
Page.Response.Flush();
p = new System.Diagnostics.Process();
p.StartInfo.FileName = "c:\\windows\\system32\\tracert";
p.StartInfo.Arguments = Request.Params["ip"]; //"217.88.223.186";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
p.PriorityClass = System.Diagnostics.ProcessPriorityClass.Normal;
while (!p.HasExited)
{
strTemp = p.StandardOutput.ReadLine();
if(strTemp.Length > 3) Page.Response.Output.Write(strTemp+"\n");
Page.Response.Flush();
if(!Response.IsClientConnected)
{
p.Kill();
break;
}
}
Response.Flush();
Response.Close();
}