Global.asax and Logging
Is there an event that I can tap into in Global.asax to exec开发者_Go百科ute some SQL in ADO.NET for logging every time a request is made to the application?
Most of the time you would be able to get the information about the request in the IIS logs. You can use logparser which provides SQL like functionality to query what you want.
To add more information to IIS logs you can use Response.AppendToLog
To capture all request for an App, you can use Application_BeginRequest event of the Global.asax
There are better ways to do it, but call whatever you want in Begin_Request.
Specifically:
protected void Application_BeginRequest(object sender, EventArgs e)
{
//Do something at the beginning of every request.
}
I think you need to investigate HttpModules (2) (3).
精彩评论