Apache
  Home arrow Apache arrow Page 2 - ASP: Active Sessions, Active Logins and To...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Actuate Whitepapers 
Moblin 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
APACHE

ASP: Active Sessions, Active Logins and Total Site Hits
By: Softwaremaker
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 9
    2003-03-03

    Table of Contents:
  • ASP: Active Sessions, Active Logins and Total Site Hits
  • Problem Solved
  • Writing The Code
  • Active Logins
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    ASP: Active Sessions, Active Logins and Total Site Hits - Problem Solved


    (Page 2 of 5 )

    Sure you can paste this tracker component on every page on your site, but that would be highly cumbersome, inefficient and inaccurate as that would be lots of double-counting. You also cannot keep track of the active sessions on your site which means the number of visitors to your site at any moment. Moreover, once you update your page, or when the server shuts-down for maintenance, you lose all data and history of your hit counts.

    I am sure there are components out there that can do the job but it all depends on the price and whether your remote web administrator allows you to install these components on your virtual server (sharing the server with many websites).

    There is a simple and free way to do what is described above via Microsoft Active Server Pages (ASP) which is widely used and implemented and free. Most websites, whether they are running IIS or Apache, support ASP.

    All you need to do is to upload this script on this page to your server and you will be able to see a fairly accurate count of hits on your site, not just the page alone.
    The scripts provided below MUST be pasted on a text-based file called GLOBAL.ASA.

    This file is always read by the server first whenever a browser requests HTTP content from the web server and its therefore accurate as any pages requested by the server will go through the GLOBAL.ASA file first.

    The GLOBAL.ASA file is a fairly narrow topic but I will only highlight the 4 events that the GLOBAL.ASA file implements. You can also declare application-wide objects and variables on this file but we will only focus on keeping track of site-hits here.

    The events that the GLOBAL.ASA file implements corresponds to the Application and Session Object. They are namely Application_OnStart, Session_OnStart, Session_OnEnd and Application_OnEnd. They are all run in that order.

    Application objects are used throughout the application regardless of the users and are started when the web-server starts and ends when the web-server shuts down (or when you copy a newer version of the GLOBAL.ASA file onto it). Session objects, on the other hand, are used per browser session. This means that a new browser, regardless of where it comes from, instantiates a new session. Session objects are cleared and re-initialized when the session times out which in most cases is 10 minutes.

    More Apache Articles
    More By Softwaremaker


     

    APACHE ARTICLES

    - Programmatically Manipulating Microsoft Exce...
    - Installing PHP under Windows
    - Compressing Web Content with mod_gzip and mo...
    - Compressing Web Output Using mod_deflate and...
    - Setting Up Apache 2.0.45 to Parse PHP Pages
    - Custom Error 404 Documents with PHP
    - Using Apache and PHP on Mac OS X
    - ASP: Active Sessions, Active Logins and Tota...
    - Working With Oracle on Windows: Part 1
    - The Quick-n-Dirty Guide to Setting Up Apache...
    - Installing Apache With SSL: The Complete Gui...
    - 7 Powerful .htaccess Customization Tips
    - Trap And Get Notified: A Practical Solution ...
    - One Way To Use Server Side Includes
    - Using ForceType For Nicer Page URLs







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway