Console.writeline() will not write to a ASP.NET page, Framework 2.0

Thought for sure that I have done this in Framework 1.1, but will not work with 2.0

The problem is simply writting to the web page console, can not seem to get the Console.Writeline function to work.... Tried setting the Console.Setout() but still no success. No error messages just nothing displayed from the Console.Writeline function. MSDN documents the issue if the default output is not the console, nothing is displayed.

Any help appreciated...

Partial of the code that I am using. Have attempted to set the the Console.Setout w/o any success.

Try

Dim outStream As New System.IO.StreamWriter(Console.OpenStandardOutput())

Console.SetOut(outStream)

Console.WriteLine("Testing writting to a web page.")

Finally

End Try

D. Davidson



Answer this question

Console.writeline() will not write to a ASP.NET page, Framework 2.0

  • KZoli

    Console.Writeline will not work in web applications, it will only work in windows-based applications,

  • The D

    Hi!

    Yep, David is right. You can use Response.WriteLine, or System.Diagnostic.Debug.WriteLine if you just want it to show up in the VS environment.

    The best place for asking ASP.NET questions is on the ASP.NET community site, and in the forums there. Check out http://www.asp.net/welcome.aspx tabindex=1&tabid=39.

    HTH,

    PEte



  • AL-Wakeel Adnan

    Yea Console.WriteLine is for only writing to the Console window for a windows application. This won't work for web applications.



  • _jesse

    Thanks very MUCH !!!
  • R Raghu

    If I understand you correctly, Response.Write is how you write output to a webpage, although it's not the nice way to do things.



  • Console.writeline() will not write to a ASP.NET page, Framework 2.0