CodeAve.com CodeAve.com - ASP - Read/Write
ASP
·Read/Write
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·Articles
·Miscellaneous
·Contents
·What's New?
JavaScript
CSS
HTML
Maps
Links
Mail List
Search
Sitemap


 


ASP Session Counter
There are many ways to track usage of a website.  The simplest way is with a hit counter.  However, a hit counter will not give you an estimate of how many unique user sessions were opened in your site.  The code provided below is one of the simplest session counters that can be made in .asp.  A text document (session_count.txt) is placed in the same directory (providing that directory has write access, you may need to place the .txt document in your cgi-bin depending on your provider) as the page we want the session counter to appear on.  The .txt file is first read to gain the value of the last session count, one is added to that number, written to the .txt document, closed and the counter value is written as text to the page.  Refreshing the content of the output page will continually display the last session number.  In order for the number to increment you must close all of your current browser sessions and re-visit the page or open another browser.
View the Output
Text View
Print View
Mail this Link
Download the Code

<%
set fso = createobject("scripting.filesystemobject")
set act = fso.opentextfile(server.mappath("session_count.txt"))
counter = clng(act.readline)
if session("been_here_before") = "" then
session("been_here_before") = "Yes"
counter = counter + 1
Set act = fso.CreateTextFile(server.mappath("session_count.txt"), true)
act.WriteLine(counter)
end if
act.Close
Response.Write counter
%>

 

 

 



ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement

    CodeAve.com is hosted by MyHosting.com
    Donate Food Online with a Mouse Click at TheHungerSite.com
    Donate Land Online with a Mouse Click at TheRainForestSite.com
    © 1999 - 2017 CodeAve.com
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3