Note that there are some explanatory texts on larger screens.

plurals
  1. POasp.net visitors count (online users) for today-yesterday in .net 4
    text
    copied!<p>i wrote the below codes for visitors count (online users) for my application : </p> <p>reference :<br> <a href="http://aspdotnetfaq.com/Faq/How-to-show-number-of-online-users-visitors-for-ASP-NET-website.aspx" rel="nofollow">http://aspdotnetfaq.com/Faq/How-to-show-number-of-online-users-visitors-for-ASP-NET-website.aspx</a></p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Security; using System.Web.SessionState; using CardCharge.Classes; namespace CardCharge { public class Global : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { Application["OnlineUsers"] = 0; } protected void Session_Start(object sender, EventArgs e) { Application.Lock(); Application["OnlineUsers"] = (int)Application["OnlineUsers"] + 1; Application.UnLock(); } protected void Application_BeginRequest(object sender, EventArgs e) { } protected void Application_AuthenticateRequest(object sender, EventArgs e) { } protected void Application_Error(object sender, EventArgs e) { } protected void Session_End(object sender, EventArgs e) { Application.Lock(); Application["OnlineUsers"] = (int)Application["OnlineUsers"] - 1; Application.UnLock(); } protected void Application_End(object sender, EventArgs e) { } } } </code></pre> <p>also i found the below link that uses IHttpModule :<br> <a href="http://blog.sb2.fr/post/2008/12/01/HowTo-Get-Current-Online-Users-Count-and-Infos-with-ASPNET.aspx" rel="nofollow">http://blog.sb2.fr/post/2008/12/01/HowTo-Get-Current-Online-Users-Count-and-Infos-with-ASPNET.aspx</a> </p> <p>i prefer to use simple global.asax for my purpose , but these two ways are too old (3 years earlier)<br> is there any better way in .net 4 for getting online users(visitors count) out there? </p> <p>also for getting some counts (such as yesterday) i need database !<br> but is it ok to connect sql server 2008 in session_start or <strong>specially</strong> session_end in global asax ? </p> <p>thanks in advance</p>
 

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