Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Problems with any background thread in server side is each and every request is going to occupy two threads. One for serving the ASP.NET request and one for logging the stuff you want to log. So, you end up having scalability issues due to exhaustion of ASP.NET threads. And logging each and every request in database is a big no no. </p> <p>Best is to just write to log files using some high performance logging library. Logging libraries are highly optimized for multi-threaded logging. They don't produce I/O calls on each and every call. Logs are stored in a memory buffer and flushed periodically. You should use EntLib or Log4net for logging.</p> <p>You can use an HttpModule that intercepts each and every GET, POST and then inside the HttpModule you can check whether the Request.Url is an aspx or not. Then you can read Request.Headers["__ASYNCPOST"] and see if it's "true", which means it's an UpdatePanel async update. If all these conditions are true, you just log the request into a log file that stores the </p> <p>You can get the client IP from:</p> <pre><code>HttpContext.Current.Request.UserHostAddress; or HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; </code></pre> <p>To get the IP address of the machine and not the proxy use the following code</p> <pre><code>HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; </code></pre> <p>However you cannot get the country. You will have to log the IP in your log files and then process the log files using some console application or job which will resolve the country of the IP. You need to get some IP->Country database to do the job. I have used <a href="http://www.maxmind.com/app/geoip_country" rel="nofollow">http://www.maxmind.com/app/geoip_country</a> before. </p> <p>For screen size, you will have to rely on some javascript. Use a javascript on each page that finds the size of the screen on the client side and stores in a cookie. </p> <pre><code>var screenW = 640, screenH = 480; if (parseInt(navigator.appVersion)&gt;3) { screenW = screen.width; screenH = screen.height; } else if (navigator.appName == "Netscape" &amp;&amp; parseInt(navigator.appVersion)==3 &amp;&amp; navigator.javaEnabled() ) { var jToolkit = java.awt.Toolkit.getDefaultToolkit(); var jScreenSize = jToolkit.getScreenSize(); screenW = jScreenSize.width; screenH = jScreenSize.height; } </code></pre> <p>Once you store it in a cookie (I haven't shown that code), you can read the screen dimensions from the HttpModule by using Request.Cookies and then log it in the log file. </p> <p>So, this gives you solution for logging IP, screensize, finding country from IP, and filtering UpdatePanel async postback from logging.</p> <p>Does this give you a complete solution to the problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload