Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to display console stream data in ASP.NET?

Posted on 2007-12-05
6
734 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

808 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