gpt4 book ai didi

c# - 如何记录站点中发生的所有错误?

转载 作者:太空宇宙 更新时间:2023-11-03 20:36:48 25 4
gpt4 key购买 nike

我想编写一个模块来记录站点中的所有错误。请指导我。

最佳答案

全局.asax:

 <%@ Application Inherits="MyProj.Global" %>

Global.asax.cs:

namespace MyProj
{
public class Global : HttpApplication
{
protected virtual void Application_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError().GetBaseException();
}
}
}

关于c# - 如何记录站点中发生的所有错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4756598/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com