Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Managing number of visitors in ASPNET5

$
0
0

How do I convert this to ASPNET5 web site. I did not find any easy way yet.
The all thing is to handle number of visitors and number members logged-in

<div>GLOBAL.asax.cs
public class MvcApplication : System.Web.HttpApplication
    {
      protected void Application_Start()
          {
          base.Application.Add("Visitor", 0);
          base.Application.Add("Member", new List<string>());
          }</div> <div></div> <div>      protected void Session_End(object sender, EventArgs e)
          {
          base.Application.Lock();
          base.Application.Set("Visitor", (int)base.Application["Visitor"] - 1);
          ((List<string>)base.Application["Member"]).Remove(base.Session.SessionID);
          base.Application.UnLock();
          }</div> <div></div> <div>      protected void Session_Start(object sender, EventArgs e)
          {
          base.Application.Lock();
          base.Application.Set("Visitor", (int)base.Application["Visitor"] + 1);
          base.Application.UnLock();
          }
   
 
 ACCOUNTCONTROLLER.cs  
public class AccountController
  public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
    {   
      SignInStatus.Success:
        ((List<string>)System.Web.HttpContext.Current.Application["Member"]).Add(Session.SessionID);
     
  public ActionResult LogOff()
    {
        System.Web.HttpContext.Current.Session.Remove(Session.SessionID);
        ((List<string>)System.Web.HttpContext.Current.Application["Member"]).Remove(Session.SessionID);


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>