2

I'm currently developing a webpage that calls a C# console application executable on the server. This is great, however, I'd really like to be able to stream the console application output in real time to a textbox on the application that called the application. I have managed to redirect the output of the console to a text file after the console application has completed, but what would be great would be to find out how to stream in real time from the application as it runs to a text box on the webpage.

6
  • 1
    possible duplicate of Capturing console output from a .NET application (C#) Commented Jan 8, 2014 at 13:54
  • Any reason you're not using a web service? Web API and Ajax/Web Sockets would make this simple. Commented Jan 8, 2014 at 13:55
  • You do not push from a server to a web client. The client has to pull the information. Commented Jan 8, 2014 at 13:56
  • What are you using MVC,webforms ? You cannot do it with C# Alone! Commented Jan 8, 2014 at 13:57
  • Thanks for responses everyone. No Moo-Juice, I can quite easily do that as stated.. @Chris Hardie thanks, will look into this.@techno I am using MVC webforms through vis. studio 2012.. Commented Jan 8, 2014 at 14:15

2 Answers 2

1

This is not a simple scenario that you can accomplish with C# alone.You have to use AJAX(Jquery)

Here is a link to an example that discuss regarding the creation of realtime log.

http://forums.asp.net/t/1602013.aspx

You will need to use UpdatePanel

Sign up to request clarification or add additional context in comments.

Comments

0

Have your web page, serverside, read the txt file and put the read text into any control you like. Then have your web page refresh itself / that control every 10 seconds.

6 Comments

"real time" Is what the OP asks
Thank you both for your advice. Alexander, I will work for this as a work around and in the interest of saving time. Thanks again for your help @techno
@techno Alexander is correct. Real time is not possible. There will always be a display as the AJAX has to poll the server at an interval. You can make it relatively short so that it's hardly noticeable though.
Real time is possible with Web Sockets, if supported.
@techno This is still not real time. AJAX (unlike Web Sockets, thanks @ChrisHardie) polls the server at a specified interval. You're just going to confuse things if you get the terminology wrong.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.