基本信息
源码名称:log4net 记录web application程序 全局错误日志 例子
源码大小:0.63M
文件格式:.zip
开发语言:C#
更新时间:2014-10-22
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Security; using System.Web.SessionState; using Common; namespace WebApplication_testLog4Net { public class Global : System.Web.HttpApplication { void Application_Start(object sender, EventArgs e) { // 在应用程序启动时运行的代码 } void Application_End(object sender, EventArgs e) { // 在应用程序关闭时运行的代码 } void Application_Error(object sender, EventArgs e) { // 在出现未处理的错误时运行的代码 Exception objExp = HttpContext.Current.Server.GetLastError(); LogHelper.ErrorLog("<br/><strong>客户机IP</strong>:" Request.UserHostAddress "<br /><strong>错误地址</strong>:" Request.Url , objExp); } void Session_Start(object sender, EventArgs e) { // 在新会话启动时运行的代码 } void Session_End(object sender, EventArgs e) { // 在会话结束时运行的代码。 // 注意: 只有在 Web.config 文件中的 sessionstate 模式设置为 // InProc 时,才会引发 Session_End 事件。如果会话模式设置为 StateServer // 或 SQLServer,则不会引发该事件。 } } }