ASP.NET异常处理/记录 [英] ASP.NET Exception Handling/Logging

查看:70
本文介绍了ASP.NET异常处理/记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有记录所有的异常在ASP.NET应用程序的简单方法?我已经通过Application_OnError事件记录未处理的异常,但我想执行记录,即使一个例外是在一个页面级别处理。

Is there an easy way to log all exceptions in an ASP.NET application? I'm already logging unhandled exceptions through the Application_OnError event, but I want to perform logging even when an exception is handled on a page level.

非常感谢。

推荐答案

假设你只抛出和捕获自己的异常类型(从System.Exception派生OFC),你可以做任何你需要你的基地,异常日志它的构造。

Assuming you are only throwing and catching your own exception-types (derived from System.Exception ofc), you could make your base-exception log whatever you need in its constructor.

这篇关于ASP.NET异常处理/记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆