ASP.NET后台怎么输出方法中间调试信息?

后台方法,不止是aspx.cs,而是页面调用的一些其它方法。
想调试这些方法,我以前winform都是MessageBox.Show一些中间结果,现在我也想用这种方式。
但想想,网页会触发 MessageBox.Show方法???而且我好像找不到System.Windows.Forms命名空间。
Console.WriteLine倒是能用,但输出到哪里去了呢……?
protected void Button_Submit_Click(object sender, EventArgs e)
{
ar = myManage.doOperate(TextBox_Gid.Text, TextBox_CommandLine.Text);
Response.Write(ar.ToString());
这样页面显示了操作结果,但我要显示 doOperate 的中间过程。怎么做?
用过Java,Systm.out.println() 会输出在 Console 窗口

Console.WriteLine输出了,但是看不到。

Response.Write是System.Web.UI.Page的方法,所以类库中也用不了。

MessageBox.Show是winform的。

针对你的情况,可以用写入日志的方式

using (System.IO.StreamWriter sw = System.IO.File.AppendText("D:\log.txt"))
 
{
 
    sw.WriteLine("输出结果");
 
}
 
 
原文地址:https://www.cnblogs.com/yuhuameng/p/4975515.html