Solved

How to display console stream data in ASP.NET?

Posted on 2007-12-05
6
708 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

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

Accepted Solution

by:
Jens Fiederer earned 500 total points
Comment Utility
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
Comment Utility
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

762 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

12 Experts available now in Live!

Get 1:1 Help Now