在Global.asax中是否有一个事件可以在ADO.NET中执行某些SQL,以便每次向应用程序发出请求时进行记录?Global.asax和Logging
回答
大多数情况下,您将能够在IIS日志中获取有关请求的信息。您可以使用提供类似于SQL的功能的logparser来查询您想要的内容。
要更多信息添加到IIS日志,您可以使用Response.AppendToLog
要捕获一个应用程序的所有要求,可以使用在Global.asax中的Application_BeginRequest事件
有更好的方法来做到这一点,但在Begin_Request中调用任何你想要的。
具体做法是:
protected void Application_BeginRequest(object sender, EventArgs e)
{
//Do something at the beginning of every request.
}
我认为你需要调查HttpModules(2)(3)。
我只是试图做一个这.LogRequest + = new EventHandler(global_asax_LogRequest); 但后来我得到了“这个操作需要IIS集成管道模式。”我假设我现在在工作的公司正在IIS6上运行一些ASP.NET,而在IIS7上运行一些。思考? – BuddyJoe 2010-03-17 20:47:37
是啊 - 我见过它之前:) http://stackoverflow.com/questions/186548/iis6-httpmodule-this-operation-requires-iis-integrated-pipeline-mode – annakata 2010-03-17 20:57:56
- 1. Castle Logging Facility和log4net.Config.XmlConfigurator
- 2. Global.asax和继承
- 3. Log4Net,ThreadContext和Global.asax
- 4. Page_PreRender和Global.asax
- 5. log4j和Commons Logging共存
- 6. Tomcat和Logging Stacktrace信息
- 7. 异常,Global.asax和eventlog
- 8. PreparedStatement Logging
- 9. Logging InputStream
- 10. Logging Intellitrace?
- 11. commons-logging-api-1.1.jar vs. commons-logging-1.2.jar
- 12. 的Global.asax和用户访问
- 13. Mod_mono忽略global.asax和httpmodules
- 14. asp.net global.asax.cs和global.asax的区别
- 15. ASP.NET gzip脚本和CSS Global.asax
- 16. global.asax和经典的ASP?
- 17. Kubernetes Liveness Probe Logging
- 18. ASP.NET Core 1.0 logging
- 19. Sinatra Logging&Stack Traces
- 20. Spring Boot Logging Configuration
- 21. Android Issue Logging ArrayList
- 22. django/python logging
- 23. Crashlytics Logging NSError
- 24. Spring Boot and Logging
- 25. Strip Android NDK Logging
- 26. Rails Logging API
- 27. Shell-Script Logging
- 28. 问题logging arraylist
- 29. Spring Boot Jackson - Logging
- 30. Gradle Logging Output Levels
然后,你会怎么要求的完整路径请求的页面减去服务器路径?然后在一个单独的变量中请求服务器名称。我是否通过两个ServerVariables来解决这个问题? – BuddyJoe 2010-03-17 20:52:12
在ASP.NET Request.Url.PathAndQuery将提供完整的url - 域名。 Request.Url.Host - 将给主机 在IIS日志中 cs-uri-query - 将给出的URI - 服务器 cs-host - 将给出的域名 – Ramesh 2010-03-17 20:59:33