asp.net webform 动态调试技巧

<script runat="server">
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        Trace.Warn("TextBox1_TextChanged");
    }
</script>

 

<script runat="server">
    protected override void OnPreInit(EventArgs e)
    {
        AppDomain.CurrentDomain.FirstChanceException += new EventHandler<System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs>(CurrentDomain_FirstChanceException);
        base.OnPreInit(e);
    }

    void CurrentDomain_FirstChanceException(object sender, System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs e)
    {
        log4net.ILog log = log4net.LogManager.GetLogger(this.GetType());
        log.Error("FirstChanceException", e.Exception);
    }
</script>

 

posted on 2022-06-30 10:19  空明流光  阅读(122)  评论(0编辑  收藏  举报

导航