存储系统错误日志
111在global.asax中
<%@?Application?Language="C#"?%>
<%@?Import?Namespace="System.Diagnostics"?%>
<script?RunAt="server">
????void?Application_Start(object?sender,?EventArgs?e)
????{
????????//在應用程序啟動時運行的代碼
????}
????void?Application_End(object?sender,?EventArgs?e)
????{
????????//在應用程序關閉時運行的代碼
????}
????void?Application_Error(object?sender,?EventArgs?e)
????{
????????//在出現未處理的錯誤時運行的代碼
????????Exception?ex?=?Server.GetLastError().GetBaseException();
????????string?message?=?ex.Message;//異常消息
????????string?source?=?ex.Source;//導致異常的應用程序或對象名稱
????????string?StackTrace?=?ex.StackTrace.ToString();
????????string?TargetSite?=?ex.TargetSite.ToString();
????????string?Form?=?Request.Form.ToString();
????????string?QueryString?=?Request.QueryString.ToString();
????????//addlog();
????}
????void?Session_Start(object?sender,?EventArgs?e)
????{
????????//在新會話啟動時運行的代碼
????}
????void?Session_End(object?sender,?EventArgs?e)
????{
????????//在會話結束時運行的代碼。?
????????//?注意:?只有在?Web.config?文件中的?sessionstate?模式設置為
????????//?InProc?時,才會引發?Session_End?事件。如果會話模式?
????????//設置為?StateServer?或?SQLServer,則不會引發該事件。
????}
???????
</script>
<%@?Application?Language="C#"?%>
<%@?Import?Namespace="System.Diagnostics"?%>
<script?RunAt="server">
????void?Application_Start(object?sender,?EventArgs?e)
????{
????????//在應用程序啟動時運行的代碼
????}
????void?Application_End(object?sender,?EventArgs?e)
????{
????????//在應用程序關閉時運行的代碼
????}
????void?Application_Error(object?sender,?EventArgs?e)
????{
????????//在出現未處理的錯誤時運行的代碼
????????Exception?ex?=?Server.GetLastError().GetBaseException();
????????string?message?=?ex.Message;//異常消息
????????string?source?=?ex.Source;//導致異常的應用程序或對象名稱
????????string?StackTrace?=?ex.StackTrace.ToString();
????????string?TargetSite?=?ex.TargetSite.ToString();
????????string?Form?=?Request.Form.ToString();
????????string?QueryString?=?Request.QueryString.ToString();
????????//addlog();
????}
????void?Session_Start(object?sender,?EventArgs?e)
????{
????????//在新會話啟動時運行的代碼
????}
????void?Session_End(object?sender,?EventArgs?e)
????{
????????//在會話結束時運行的代碼。?
????????//?注意:?只有在?Web.config?文件中的?sessionstate?模式設置為
????????//?InProc?時,才會引發?Session_End?事件。如果會話模式?
????????//設置為?StateServer?或?SQLServer,則不會引發該事件。
????}
???????
</script>
轉載于:https://www.cnblogs.com/aaa6818162/archive/2009/08/06/1540315.html
總結
- 上一篇: CRM下午茶(23)-维护客户关系的最佳
- 下一篇: [转]在Winform(C#)中使用Fl