views:

165

answers:

3

I want to save each request to the website. In general I want to include the following information:

  1. User IP, The web site url, user-if-exist, date-time.
  2. Response time, response success-failed status.

Is it reasonable to collect the 1 and 2 in the same action? (like same HttpModule)?

Do you know about any existing structure that I can follow that track every request/response-status to the website?

The data need to be logged to sql server.

A: 

Look in your web server logs.

Hank Gay
The data need to be logged to sql server.
stacker
You can configure iis to post the logs to a sql server instead of the file system.
Chris Lively
+1  A: 

How about IIS logs? they already have all the data items you listed so far

mfeingold
Don't HttpModule better solution? How the IIS can know bout error, if the error will never be shown to the user? Can you have any link?
stacker
No it is not. Some requests will never get to ASP.NET process - i.e. bad urls (HTTP 404) and the such. Also the response is always sent back. It may be hidden by the browser behind a pretty (but useless) screen, but it will be there and in the logs
mfeingold
A: 

In BeginRequest Method you need to write the following code.

protected void Application_BeginRequest(object sender, EventArgs e) { //String s = HttpContext.Current.Request.Path; //HttpContext.Current.RewritePath("Login.aspx"); String referrer = HttpContext.Current.Request.UrlReferrer; String sourceIP = HttpContext.Current.Request.UserHostAddress; String browser = HttpContext.Current.Request.UserAgent ;

}
Ajay