Click here to Skip to main content
15,920,030 members
Please Sign up or sign in to vote.
1.00/5 (5 votes)
See more:
I have code for console application in C# and the output in command prompt

but i want output on normal screen by using web application?? if yes please explain the procedure ??

What I have tried:

i tried in different ways but cant get the output please explain anyone
Updated 3-May-17 22:35pm
F-ES Sitecore 9-Jan-17 11:04am    
There isn't enough information to answer the question. First off is this a webforms app or MVC? Secondly does the console app "do something" as a single piece of work and you just want to show the results in a browser? Or is it always running and generating output? Does it need any input at all?

At the most basic levels rather than using Console.Write, add the output to a StringBuilder instead and once the work has been done show the contents of the StringBuilder on the page using whatever technique is appropriate for the web technology you choose.
Member 12941572 10-Jan-17 4:10am    
actually i have a code to read usb based card when we insert the card and run the program it displays the information about the card in command prompt and the code is written in console application type in c# .NET

it has both input and output properties but i want the output on webform instead of command prompt any suggestions ???
F-ES Sitecore 10-Jan-17 4:35am    
You can't convert that to a web site as the server code doesn't have access to client hardware like the USB devices.

The answer is - Yes. It can be done. However, given the limited scope of your question, that's the best answer I can give.
Share this answer
Member 12941572 10-Jan-17 4:11am    
how can you please explain the procedure
Member 13046055 1-Dec-17 2:44am    
im trying this exercise .Using any application of your choice output the character ‘s’.
Yes. But ... it's a poor idea.
Web pages are designed to be interactive, using touch, click, and keyboard - reacting to user triggered events to perform actions. Console apps aren't so much - they are text based, with user interaction confined to "what the app wants, when the app wants it" which isn't really compatible with the web based model.
Plus, a console app is client only, where a webpage is generally server based with rending and direct interaction only processed on the client. C# code in a web app is always executed at the server, not the client, so it's not a direct conversion.

What I'd probably do is look at what the app does, and respecify it for a new - and different - web application, using the business logic from the console app where possible.
Convert the original directly? Probably not going to give a good result, and I wouldn't do it myself.
Share this answer
Member 12941572 10-Jan-17 4:17am    
Thank you ,but i want make a gui based on the program so i want to run the program on normal screen instead of command prompt
OriginalGriff 10-Jan-17 4:39am    
Then you need to sit down and work out how your GUI is going to work: there isn't a single, simple "do this" and it will magically become a GUI application. They work very, very differently: GUI apps react to events that occur through the operating system as a whole as well as user actions. Console apps force the user to do things at specific times and won't let anything else happen at the same time.
The two are not similar enough to just "translate", any more than learning to ride a motorcycle qualifies you to fly a jet fighter!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900