number of online users?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Esref DURNA

    number of online users?

    how I could count the number of online users with asp .net?
    which complement should i use?


  • Hans Kesting

    #2
    Re: number of online users?

    Esref DURNA wrote:[color=blue]
    > how I could count the number of online users with asp .net?
    > which complement should i use?[/color]

    Probably something like this:
    - have a counter in the Application object
    - on Session start increment the counter
    - on Session end decrement it

    This should count all active sessions, but there are some warnings:
    - a session is counted until it ends, which is 20 min. after the user has left your site
    - I read somewhere (can't remember the link - can someone confirm?)
    that Session_OnEnd is not called if nothing was stored in the session.

    Hans Kesting


    Comment

    • Patrice

      #3
      Re: number of online users?

      Another option is to read the corresponding performance counter (and perhaps
      cache the value as there is probably no need to have alwxays the exact
      value)...

      Patrice

      --

      "Hans Kesting" <news.2.hansdk@ spamgourmet.com > a écrit dans le message de
      news:eiUfPQ7pEH A.536@TK2MSFTNG P11.phx.gbl...[color=blue]
      > Esref DURNA wrote:[color=green]
      > > how I could count the number of online users with asp .net?
      > > which complement should i use?[/color]
      >
      > Probably something like this:
      > - have a counter in the Application object
      > - on Session start increment the counter
      > - on Session end decrement it
      >
      > This should count all active sessions, but there are some warnings:
      > - a session is counted until it ends, which is 20 min. after the user has[/color]
      left your site[color=blue]
      > - I read somewhere (can't remember the link - can someone confirm?)
      > that Session_OnEnd is not called if nothing was stored in the session.
      >
      > Hans Kesting
      >
      >[/color]


      Comment

      • Erik

        #4
        Re: number of online users?

        Can you tell me how I can read this performance counter?
        The global.asax way seems not to work on my server.

        "Patrice" wrote:
        [color=blue]
        > Another option is to read the corresponding performance counter (and perhaps
        > cache the value as there is probably no need to have alwxays the exact
        > value)...
        >
        > Patrice
        >
        > --
        >
        > "Hans Kesting" <news.2.hansdk@ spamgourmet.com > a écrit dans le message de
        > news:eiUfPQ7pEH A.536@TK2MSFTNG P11.phx.gbl...[color=green]
        > > Esref DURNA wrote:[color=darkred]
        > > > how I could count the number of online users with asp .net?
        > > > which complement should i use?[/color]
        > >
        > > Probably something like this:
        > > - have a counter in the Application object
        > > - on Session start increment the counter
        > > - on Session end decrement it
        > >
        > > This should count all active sessions, but there are some warnings:
        > > - a session is counted until it ends, which is 20 min. after the user has[/color]
        > left your site[color=green]
        > > - I read somewhere (can't remember the link - can someone confirm?)
        > > that Session_OnEnd is not called if nothing was stored in the session.
        > >
        > > Hans Kesting
        > >
        > >[/color]
        >
        >
        >[/color]

        Comment

        • Patrice

          #5
          Re: number of online users?

          Try :


          You could also impersonate by code just the time needed to get the counter.
          Also you way want to "cache" this value if you don't need the real value at
          any one time (is it for admin purpose or to display this to users ?).

          Patrice

          --

          "Erik" <Erik@discussio ns.microsoft.co m> a écrit dans le message de
          news:B387A8F9-F816-49CA-BAF7-F3EC7F010342@mi crosoft.com...[color=blue]
          > Can you tell me how I can read this performance counter?
          > The global.asax way seems not to work on my server.
          >
          > "Patrice" wrote:
          >[color=green]
          > > Another option is to read the corresponding performance counter (and[/color][/color]
          perhaps[color=blue][color=green]
          > > cache the value as there is probably no need to have alwxays the exact
          > > value)...
          > >
          > > Patrice
          > >
          > > --
          > >
          > > "Hans Kesting" <news.2.hansdk@ spamgourmet.com > a écrit dans le message[/color][/color]
          de[color=blue][color=green]
          > > news:eiUfPQ7pEH A.536@TK2MSFTNG P11.phx.gbl...[color=darkred]
          > > > Esref DURNA wrote:
          > > > > how I could count the number of online users with asp .net?
          > > > > which complement should i use?
          > > >
          > > > Probably something like this:
          > > > - have a counter in the Application object
          > > > - on Session start increment the counter
          > > > - on Session end decrement it
          > > >
          > > > This should count all active sessions, but there are some warnings:
          > > > - a session is counted until it ends, which is 20 min. after the user[/color][/color][/color]
          has[color=blue][color=green]
          > > left your site[color=darkred]
          > > > - I read somewhere (can't remember the link - can someone confirm?)
          > > > that Session_OnEnd is not called if nothing was stored in the[/color][/color][/color]
          session.[color=blue][color=green][color=darkred]
          > > >
          > > > Hans Kesting
          > > >
          > > >[/color]
          > >
          > >
          > >[/color][/color]


          Comment

          • Erik

            #6
            Re: number of online users?

            This is for display purpose so a kind of accurate number would be best.

            "Patrice" wrote:
            [color=blue]
            > Try :
            > http://aspnet.4guysfromrolla.com/articles/041002-1.aspx
            >
            > You could also impersonate by code just the time needed to get the counter.
            > Also you way want to "cache" this value if you don't need the real value at
            > any one time (is it for admin purpose or to display this to users ?).
            >
            > Patrice
            >
            > --
            >
            > "Erik" <Erik@discussio ns.microsoft.co m> a écrit dans le message de
            > news:B387A8F9-F816-49CA-BAF7-F3EC7F010342@mi crosoft.com...[color=green]
            > > Can you tell me how I can read this performance counter?
            > > The global.asax way seems not to work on my server.
            > >
            > > "Patrice" wrote:
            > >[color=darkred]
            > > > Another option is to read the corresponding performance counter (and[/color][/color]
            > perhaps[color=green][color=darkred]
            > > > cache the value as there is probably no need to have alwxays the exact
            > > > value)...
            > > >
            > > > Patrice
            > > >
            > > > --
            > > >
            > > > "Hans Kesting" <news.2.hansdk@ spamgourmet.com > a écrit dans le message[/color][/color]
            > de[color=green][color=darkred]
            > > > news:eiUfPQ7pEH A.536@TK2MSFTNG P11.phx.gbl...
            > > > > Esref DURNA wrote:
            > > > > > how I could count the number of online users with asp .net?
            > > > > > which complement should i use?
            > > > >
            > > > > Probably something like this:
            > > > > - have a counter in the Application object
            > > > > - on Session start increment the counter
            > > > > - on Session end decrement it
            > > > >
            > > > > This should count all active sessions, but there are some warnings:
            > > > > - a session is counted until it ends, which is 20 min. after the user[/color][/color]
            > has[color=green][color=darkred]
            > > > left your site
            > > > > - I read somewhere (can't remember the link - can someone confirm?)
            > > > > that Session_OnEnd is not called if nothing was stored in the[/color][/color]
            > session.[color=green][color=darkred]
            > > > >
            > > > > Hans Kesting
            > > > >
            > > > >
            > > >
            > > >
            > > >[/color][/color]
            >
            >
            >[/color]

            Comment

            • Erik

              #7
              Re: number of online users?

              By the way I am using C# and the global.asax is VBScript. could this be the
              problem why this is not working?
              If I use the same code in VB on my page than it does work.



              "Patrice" wrote:
              [color=blue]
              > Try :
              > http://aspnet.4guysfromrolla.com/articles/041002-1.aspx
              >
              > You could also impersonate by code just the time needed to get the counter.
              > Also you way want to "cache" this value if you don't need the real value at
              > any one time (is it for admin purpose or to display this to users ?).
              >
              > Patrice
              >
              > --
              >
              > "Erik" <Erik@discussio ns.microsoft.co m> a écrit dans le message de
              > news:B387A8F9-F816-49CA-BAF7-F3EC7F010342@mi crosoft.com...[color=green]
              > > Can you tell me how I can read this performance counter?
              > > The global.asax way seems not to work on my server.
              > >
              > > "Patrice" wrote:
              > >[color=darkred]
              > > > Another option is to read the corresponding performance counter (and[/color][/color]
              > perhaps[color=green][color=darkred]
              > > > cache the value as there is probably no need to have alwxays the exact
              > > > value)...
              > > >
              > > > Patrice
              > > >
              > > > --
              > > >
              > > > "Hans Kesting" <news.2.hansdk@ spamgourmet.com > a écrit dans le message[/color][/color]
              > de[color=green][color=darkred]
              > > > news:eiUfPQ7pEH A.536@TK2MSFTNG P11.phx.gbl...
              > > > > Esref DURNA wrote:
              > > > > > how I could count the number of online users with asp .net?
              > > > > > which complement should i use?
              > > > >
              > > > > Probably something like this:
              > > > > - have a counter in the Application object
              > > > > - on Session start increment the counter
              > > > > - on Session end decrement it
              > > > >
              > > > > This should count all active sessions, but there are some warnings:
              > > > > - a session is counted until it ends, which is 20 min. after the user[/color][/color]
              > has[color=green][color=darkred]
              > > > left your site
              > > > > - I read somewhere (can't remember the link - can someone confirm?)
              > > > > that Session_OnEnd is not called if nothing was stored in the[/color][/color]
              > session.[color=green][color=darkred]
              > > > >
              > > > > Hans Kesting
              > > > >
              > > > >
              > > >
              > > >
              > > >[/color][/color]
              >
              >
              >[/color]

              Comment

              Working...