zoukankan      html  css  js  c++  java
  • 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("输出结果");
     
    }
     
     
  • 相关阅读:
    171. Excel Sheet Column Number (Easy)
    349. Intersection of Two Arrays (Easy)
    453. Minimum Moves to Equal Array Elements (Easy)
    657. Judge Route Circle (Easy)
    CSS笔记
    保存页面状态
    UI开发总结
    ubuntu 下配置munin
    反向代理配置
    JavaScript 高级程序设计第二版
  • 原文地址:https://www.cnblogs.com/yuhuameng/p/4975515.html
Copyright © 2011-2022 走看看