How to keep track of users?

Last post 12-28-2007 9:00 AM by gopalanmani. 2 replies.

Sort Posts:

  • How to keep track of users?

    12-28-2007, 5:18 AM
    • Member
      30 point Member
    • k2_santhosh
    • Member since 11-25-2007, 6:34 AM
    • Posts 134

    Hi

    Question1: 

    I wanted to show the list of users who were currently browsing my portal in a list. How do i do that?

    Question2:  

    How to keep track of visitors and no. of hits who visited my site so far?

     

    Thanks!

    Santhosh

  • Re: How to keep track of users?

    12-28-2007, 8:30 AM
    Answer
    • Participant
      1,917 point Participant
    • interwanderer1
    • Member since 04-03-2005, 3:29 PM
    • Belgium
    • Posts 395
  • Re: How to keep track of users?

    12-28-2007, 9:00 AM
    Answer
    • Contributor
      3,758 point Contributor
    • gopalanmani
    • Member since 07-28-2006, 10:45 AM
    • Posts 633

     

    Hi,

    maintain the visiters count and active visiter in global.asax file. try to like this.

     

     Code:

    <%@ Application Language="C#" %>
     
    <script runat="server">
    public void Application_Start(Object sender, EventArgs e)
    {
        VisitorCount = 0;
    }
     
    public void Session_Start(Object sender, EventArgs e)
    {
        VisitorCount += 1;
    }
     
    public void Session_End(Object sender, EventArgs e)
    {
        VisitorCount -= 1;
    }
     
    private int VisitorCount
    {
        get
        {
            return (int)Application["VisitorCount"];
        }
        set
        {
            Application.Lock();
            Application["VisitorCount"] = value;
            Application.UnLock();
        }
    }
    </script>
Page 1 of 1 (3 items)