2eNetWorX :: Development Community with Tutorial, Script, Code, Programming sections for Visual Basic, Active Server Pages and .Net Framework Developers.  

Who is Online? Code Sample - 2eNetWorX


Who is Online? Code Sample

 
  2eNetWorX :: ASP, VB, Asp.Net, Vb.Net, C#, dotNet, .Net OpenSource Projects
MyDev What's New | Projects | Tutorials & Articles | Services | Stats | Contact Us
Guest-20872    /dev :: home :: samples :: who is online  570 online visitors
Popular Projects

  • TableEditor
  • StatCounteX
  • 2eNetWorX/Dev
  • MiniSurvey
  • OpenForum
  • PowerTool
  • ShopEZ
  • Trans-It
  • HiLiteR
  • (View All Projects)


    Top 10

    » Contributions


    Tutorials & Articles

    » Recordset Cache
    » OpenSource
    » Statisticus
    » OpenCYA!


    Code Samples

    » Undocumented...
    » Ask For Login
    » DSN'less Connection
    » Who's Online?
    » (All Samples)


    Link Back



    Site Banner


  • Who is Online Sample Code.

    I am sure that you also want to know who is currently using your site, moreover, who is doing what? If your site features a membership system somehow, it's easy to implement such a system so that you can display a list of online users.

    The trick is to use global.asa file to capture Session_OnStart and Session_OnEnd events. We simply keep an application variable to store the list of the online users. When a new user starts a session we add him/her to the list, and when his/her session ends we remove the user from the list.

    Current implementation utilizes the Scripting.Dictionary object, serving as an advanced array which you can access the items via their keys.

    Required files and code

    You will need three different pieces of code to get this working as it does on this site:

    » global.asa is used to catch the session events.

    (If you already have a global.asa, combine this file with yours, if not, just upload this in your application's (site's) root folder)

    » header part is used to update the visitor's path info.

    (You should put an include statement for _onlineusers.asp file in all of your files. If you have a common header file (like _header.asp here) you only need to include it within that)

    » whoson.asp is used to display the list of the online users.

    (Either put this as a seperate file, or copy and modify the code to display the list as you like, in any file)

    Click on either piece for a syntax highlighted source code.

    Although global.asa method is not perfect, it's the fastest one for "Who is Online" implementations. The problem with global.asa is, for some sessions, session_onend event never fires, causing some users seem like hanged on the site.

    Well that's it. Contact us if you have any questions, improvements, ideas or contributions.

    Code highlighting is powered by HiLiteR 1.1



    Who's Online

     Bot: Msn
     Bot: Google
     (381) guests
     (187) repeated

    How is this done?


    Popular Web Sites

      echoPANEL, Free .NET
      Webserver Control Panel

      FogBugz Hosting Plans
      SubVersion Hosting Plans
      SourceGear Vault
      Hosting Plans

    Admin's Toolbox

    Web Database Management
    Web Site Statistics
    Survey Manager
    Integrated forum for webpages
    OpenSource WebSite Framework


      privacy policy , license , disclaimer , © 2000-2004, 2eNetWorX.   [page generated in 578 ms.]