Solved

How to display console stream data in ASP.NET?

Posted on 2007-12-05
6
728 Views
Last Modified: 2008-02-01
I just asked a similar question about displaying console output to a ASP.NET textbox and that did the trick.  However, I am using the following lines:

System.Diagnostics.Process p = System.Diagnostics.Process.Start(info);
this.txtStatus.Text = p.StandardOutput.ReadToEnd();

This appears to wait until the entire process is done before showing any output.  Is there someway to get it to display dynamically, i.e., whenever something is output from the console?   This is very urgent, so I appreciate your help!
0
Comment
Question by:jvalescu
  • 3
  • 2
6 Comments
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 20413745
Well you ASKED to "ReadToEnd", so it MUST wait until the process is done!

Have you tried Readline instead?  

Of course, you won't get it ALL that way.

What results are you trying to achieve?
0
 

Author Comment

by:jvalescu
ID: 20413802
Yes, I tried Readline and got the same result.  I'm thinking that somehow a threading solution must be applied.
0
 
LVL 23

Assisted Solution

by:Jens Fiederer
Jens Fiederer earned 500 total points
ID: 20413847
If you have some control over the process you are calling, you can have it flush its output after every line, and Readline should get you the first line at least.


A threading solution doesn't work in the CLASSIC web scenario, but COULD be made to work in an AJAX context, where you serve up the page with an EMPTY textbox to start with, but initiate a request that feeds you text as it is generated.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:jvalescu
ID: 20414031
Any easy example or link for more info on the AJAX method?
0
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 500 total points
ID: 20414109
There is a tutorial at
http://www.w3schools.com/ajax/default.asp

and
http://ajaxpatterns.org/Ajax_Examples

has a variety of examples of using AJAX.

I don't know of any for your SPECIFIC problem, and a lot depends on the nature of the process that is running - if the buffer is never flushed until the process is closed, you might just as well redirect the output into a file and provide a SEPARATE page to allow the user to look the last (or one of a set of) output files later when the process is finished.
0
 
LVL 23

Expert Comment

by:naveenkohli
ID: 20414539
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question