Console.WriteLine("Debug: User_Id = "+ Session["User_Id"]);
should do the trick.
Console.WriteLine("Debug: User_Id = "+ Session["User_Id"]);
should do the trick.
The Trace messages can occur in the output window as well, even if you're not in debug mode. You just have to make sure the the TRACE compiler constant is defined.
Following Frederik's advice, I found this blog post: How To Use TRACE In VS
The Trace.WriteLine method is a conditionally compiled method. That means that it will only be executed if the TRACE constant is defined when the code is compiled. By default in Visual Studio, TRACE is only defined in DEBUG mode.
Right Click on the Project and Select Properties. Go to the Compile tab. Select Release mode and add TRACE to the defined preprocessor constants. That should fix the issue for you.
Here is the thing:
If you look at the project configuration pages you will see Debug and Release tabs there: Debug mode defines DEBUG and TRACE constants and you cannot change it. That is why when you debug your code you will see output from Trace.Write and Debug.Write. Release mode defines only TRACE constant (you can add DEBUG constant if you want). When you change configuration to release you will see output only from Trace.Write (by default). When you are not debugging your code you will not see output from Trace.Write and Debug.Write.
The results are not in the Output window but in the Test Results Detail (TestResult Pane at the bottom, right click on on Test Results and go to TestResultDetails).
This works with Debug.WriteLine and Console.WriteLine.