存储系统错误日志
111在global.asax中
<%@?Application?Language="C#"?%>
<%@?Import?Namespace="System.Diagnostics"?%>
<script?RunAt="server">
????void?Application_Start(object?sender,?EventArgs?e)
????{
????????//在應(yīng)用程序啟動(dòng)時(shí)運(yùn)行的代碼
????}
????void?Application_End(object?sender,?EventArgs?e)
????{
????????//在應(yīng)用程序關(guān)閉時(shí)運(yùn)行的代碼
????}
????void?Application_Error(object?sender,?EventArgs?e)
????{
????????//在出現(xiàn)未處理的錯(cuò)誤時(shí)運(yùn)行的代碼
????????Exception?ex?=?Server.GetLastError().GetBaseException();
????????string?message?=?ex.Message;//異常消息
????????string?source?=?ex.Source;//導(dǎo)致異常的應(yīng)用程序或?qū)ο竺Q(chēng)
????????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)
????{
????????//在新會(huì)話(huà)啟動(dòng)時(shí)運(yùn)行的代碼
????}
????void?Session_End(object?sender,?EventArgs?e)
????{
????????//在會(huì)話(huà)結(jié)束時(shí)運(yùn)行的代碼。?
????????//?注意:?只有在?Web.config?文件中的?sessionstate?模式設(shè)置為
????????//?InProc?時(shí),才會(huì)引發(fā)?Session_End?事件。如果會(huì)話(huà)模式?
????????//設(shè)置為?StateServer?或?SQLServer,則不會(huì)引發(fā)該事件。
????}
???????
</script>
<%@?Application?Language="C#"?%>
<%@?Import?Namespace="System.Diagnostics"?%>
<script?RunAt="server">
????void?Application_Start(object?sender,?EventArgs?e)
????{
????????//在應(yīng)用程序啟動(dòng)時(shí)運(yùn)行的代碼
????}
????void?Application_End(object?sender,?EventArgs?e)
????{
????????//在應(yīng)用程序關(guān)閉時(shí)運(yùn)行的代碼
????}
????void?Application_Error(object?sender,?EventArgs?e)
????{
????????//在出現(xiàn)未處理的錯(cuò)誤時(shí)運(yùn)行的代碼
????????Exception?ex?=?Server.GetLastError().GetBaseException();
????????string?message?=?ex.Message;//異常消息
????????string?source?=?ex.Source;//導(dǎo)致異常的應(yīng)用程序或?qū)ο竺Q(chēng)
????????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)
????{
????????//在新會(huì)話(huà)啟動(dòng)時(shí)運(yùn)行的代碼
????}
????void?Session_End(object?sender,?EventArgs?e)
????{
????????//在會(huì)話(huà)結(jié)束時(shí)運(yùn)行的代碼。?
????????//?注意:?只有在?Web.config?文件中的?sessionstate?模式設(shè)置為
????????//?InProc?時(shí),才會(huì)引發(fā)?Session_End?事件。如果會(huì)話(huà)模式?
????????//設(shè)置為?StateServer?或?SQLServer,則不會(huì)引發(fā)該事件。
????}
???????
</script>
轉(zhuǎn)載于:https://www.cnblogs.com/aaa6818162/archive/2009/08/06/1540315.html
總結(jié)
- 上一篇: CRM下午茶(23)-维护客户关系的最佳
- 下一篇: 『收集』体验微软ImageX 玩转系统映