Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 14th, 2004, 05:24 AM
Registered User
 
Join Date: Jan 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default intranet and multiple session var's ? (counter)

Hi :) thnx for reading my post, the very first one actually..

Well.. generally i'm trying to make counters on 4 x webpages within the website.
Have created 4 x txt files which add 1 to the number in the txtfile each time a new session has been initiated by the user.

It's no problem getting it to work on 1 x webpage, but 4 !?!?.. I've read some posts assuming that it's not possible to use multiple sessions, even though u call the sessions different names. Not really sure how i can fix this..

Have looked for several hours for a IP-counter too, but haven't found any ASP-ones yet. (maybe someone else knows one ?

Will be forever'illy happy if anyone could help me in the right direction and rules, maybe even a place i can find some code i can use ?

Pasting the code underneat here :
--------------- START CODE -----------------
Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")
Set filObject = fsoObject.GetFile(Server.MapPath("counter_hovedsid e.txt"))
Set tsObject = filObject.OpenAsTextStream
lngVisitorNumber = CLng(tsObject.ReadAll)

If isEmpty(Session("counterPT")) = True Then

    'Increment the visitor counter number by 1
    lngVisitorNumber = lngVisitorNumber + 1

    'Set the session variable to true
    Session("counterPT") = True
End if

Set tsObject = fsoObject.CreateTextFile(Server.MapPath("counter_h ovedside.txt"))
tsObject.Write CStr(lngVisitorNumber)
------------ END CODE -------------

Best regards
Mirador
 
Old January 14th, 2004, 10:54 AM
Authorized User
 
Join Date: Dec 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Don't use session variables

You need to use application variables. Create one for each of the four pages and increment them each time the respective page loads. Be sure to store the application variables in your golbal.asa file

Let me know if this helps

John






Similar Threads
Thread Thread Starter Forum Replies Last Post
DTS package Global Var's frank.svs SQL Server DTS 0 July 16th, 2007 06:18 AM
Persistent Session State accross multiple pages Admiral1701 Classic ASP Professional 1 December 13th, 2006 06:46 PM
Session management in ASP .Net with Multiple web s r_ganesh76 General .NET 1 September 9th, 2004 07:09 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.