Solved

How to display console stream data in ASP.NET?

Posted on 2007-12-05
6
720 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now