Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to display console stream data in ASP.NET?

Posted on 2007-12-05
6
Medium Priority
?
770 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 1500 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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 1500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

926 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