Simple Console.ReadLine not working in ASP.NET Core project

729 views Asked by At

I have an ASP.NET Core project and I need to ask an input to the developer with a Console.ReadLine() at the project launch but it's not working. When the Console.ReadLine() is hit, it sends me to the local webpage that the project makes appear when the project is launched.

I already tried to create a Console Application project where I do the Console.ReadLine() and that I call in the ASP.NET project with a process.start() but it has exactly the same behavior and just sends me to the webpage, I see that the application is waiting something when Console.ReadLine is hit but I don't have the usual console to write an input.

I don't have a lot of code to show, it is a simple Console.ReadLine() and I don't have any exceptions.

Do you know how should I do to simply have a console where i can give an input in an asp core project ?

1

There are 1 answers

3
IAmNotARobot On

You simply cannot use Console.ReadLine() in an web oriented application. The fact that the Console class is available, is related to the .net framework, but not to the project type.