473,756 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using System.Diagnost ics.Process() to print traceroute information on webpage

Dear group,

I created an aspx page using System.Diagnost ics.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.Diagnost ics.Process p;

private void Page_Load(objec t sender, System.EventArg s e)
{
Response.Cache. SetCacheability (HttpCacheabili ty.NoCache);
Response.Cache. SetExpires(Date Time.Parse("1.2 .1973 07:00:00"));

Page.Response.C lear();
Page.Response.C ontentType = "text/plain";
Response.Append Header("Content-Disposition","f ilename=\"trace route.txt\"");
Response.Buffer Output = false;
Page.Response.O utput.Write("Tr aceRoute bearbeitet Anfrage -- bitte
warten!\n\n");
Page.Response.F lush();

p = new System.Diagnost ics.Process();
p.StartInfo.Fil eName = "c:\\windows\\s ystem32\\tracer t";
p.StartInfo.Arg uments = Request.Params["ip"]; //"217.88.223.186 ";
p.StartInfo.Cre ateNoWindow = true;
p.StartInfo.Use ShellExecute = false;
p.StartInfo.Red irectStandardOu tput = true;
p.Start();
p.PriorityClass = System.Diagnost ics.ProcessPrio rityClass.Norma l;

while (!p.HasExited)
{
strTemp = p.StandardOutpu t.ReadLine();
if(strTemp.Leng th > 3) Page.Response.O utput.Write(str Temp+"\n");
Page.Response.F lush();
if(!Response.Is ClientConnected )
{
p.Kill();
break;
}
}
Response.Flush( );
Response.Close( );
}
Nov 18 '05 #1
1 3062
Hi,

Just a thought.
Have you considered launching "tracert" on a seperate
thread?

HTH
Regards
Harsh Thakur
-----Original Message-----
Dear group,

I created an aspx page using System.Diagnost ics.Process() to launch"tracert" from shell and redirect output to Response.Output whichprints it as text/plain into my browsers window. Now that works fineso far. My problem is that while tracert process is running and ASP..NET is putting data into the pages output stream, my webapplicationis locked until tracert process exits. How can I stop locking myapplication and be able to display other aspx pages while tracert isrunning?

Thanks for your help!

Heiko Besemann

Here is my example code...

-- snip --

private System.Diagnost ics.Process p;

private void Page_Load(objec t sender, System.EventArg s e) {
Response.Cache. SetCacheability (HttpCacheabili ty.NoCache); Response.Cache. SetExpires (DateTime.Parse ("1.2.1973 07:00:00"));
Page.Response.C lear();
Page.Response.C ontentType = "text/plain"; Response.Append Header("Content- Disposition","f ilename=\"trace route.txt\""); Response.Buffer Output = false;
Page.Response.O utput.Write ("TraceRoute bearbeitet Anfrage -- bittewarten!\n\n" );
Page.Response.F lush();

p = new System.Diagnost ics.Process (); p.StartInfo.Fil eName = "c:\\windows\\s ystem32\\tracer t"; p.StartInfo.Arg uments = Request.Params["ip"]; //"217.88.223.186 "; p.StartInfo.Cre ateNoWindow = true;
p.StartInfo.Use ShellExecute = false; p.StartInfo.Red irectStandardOu tput = true; p.Start();
p.PriorityClass = System.Diagnost ics.ProcessPrio rityClass.Norma l;
while (!p.HasExited)
{
strTemp = p.StandardOutpu t.ReadLine(); if(strTemp.Leng th > 3) Page.Response.O utput.Write(str Temp+"\n"); Page.Response.F lush();
if(! Response.IsClie ntConnected) {
p.Kill();
break;
}
}
Response.Flush( );
Response.Close( );
}
.

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1205
by: Barry Munro | last post by:
Hi, I'm using the following code to print documents from the file system but i'm encountering strange behaviour. If I print one document it works ok but if i say loop round a list of files and print them they start coming out in the wrong order, some of the documents are printed multiple times and others are not printed at all. I think it might be the invoked application, word, outlook, acrobat etc, getting in a mess when it has to...
1
2525
by: Sriram | last post by:
Hi. Following code works fine on XP, but not on W2K+SP4. When I run it on W2K, it does not give me any error, exception. I have tried setting StartInfo.ErrorDialog = True, ErrorDialogParentHandle, CreateNoWindow = False, but in vain... The xcopy is available in the path set in system environment variable of W2k box...
0
3298
by: Daniel Reber | last post by:
I am trying to start a process from a windows service but when the process starts the command window that the process runs in never shows. Is this because I am calling it from a windows service? Is there something else that I need to do? Here is my code: System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
1
6077
by: Morten | last post by:
Hi! Does anyone know why the code below always returns an "access is denied" error? private void Page_Load(object sender, System.EventArgs e) { System.Diagnostics.Process meProc = System.Diagnostics.Process.Start ("cmd.exe", " /c echo y| CACLS C:\\Temp /E /T /G test:F");
2
4006
by: Ram | last post by:
Hey, I'm trying to use the following code inside an ASP.NET project: System.Diagnostics.Process objProcess; objProcess = new System.Diagnostics.Process(); objProcess.StartInfo.FileName=@"c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 \gacutil.exe"; objProcess.StartInfo.Arguments = " /if c:\MyDLL.dll"; objProcess.StartInfo.RedirectStandardOutput = true; objProcess.StartInfo.UseShellExecute = false;
5
7848
by: garyusenet | last post by:
I have been trying for some time now to launch Internet Explorer from my code. I have read the MSDN notes on this way of starting processes and used their example but couldn't get it to work. I then searched the forums and made ammendments suggested to previous posters but it still isn't working. Here is my StartInternetExplorer() method. Could you please look and see what I am doing wrong? Thankyou. Gary.
0
1121
by: Speech Lover | last post by:
I am trying to find a sample from the Internet about invoking a command line from .NET 2.0 by using System.Diagnostics.Process with Domain, UserName and Password specified? All samples I found so far are without UserName and Password specified. thanks, Speech Lover
3
3194
by: Bali | last post by:
Hi I have an ASP.NET application. I am on the server side and trying to start an application which is on the server. The process gets started(can be seen in the Task Manager) but doesn't do anything(00 CPU cycles). System.Diagnostics.Process.Start("c:\\Code\\testExe\\test.exe"); Now I have gone to the testExe folder and given both ASPNet and
2
1624
JnrJnr
by: JnrJnr | last post by:
Hello. I am trying to open a .EXE file with the System.Diagnostics.Process.Start(some file path .exe) command. It works for most programs and apps but for others programs I get a warning message box "WIN_IMPROPER_QUIT_BODY" with Yes,No,Cancel option. When I click Yes or No I get an error "Error during initialization: some blah blah file not found". When I refer to the shortcut of the program Im trying to run it actually works and opens the...
0
9431
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10014
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9844
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9689
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5119
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5289
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3780
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2647
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.