473,320 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

prevent counter from incrementing when someone returns

I have a counter (alright one I found on asp101.com) that checks for a
session variable to prevent the counter from incrmenting if a user refreshes
the page or returns to the page during the same session. The problem is, it
also prevents other page counters from incrementing. Here's the code for
this part:

' Increment the count
if Session("iCount") <> iCount then
iCount = iCount + 1
Session("iCount") = iCount
end if

I changed iCount to another variable used within the code, and it works for
allowing other page counters to increment, but also increments a page you
already visited if you re-visit it and hit refresh.

' Increment the count
if Session("objCountFile") <> iCount then
iCount = iCount + 1
Session("objCountFile") = iCount
end if

The main code for the counter in on www.faerybug.com/counter.asp. I use an
include statement, <!-- #INCLUDE FILE="./counter.asp" --> to put the counter
on a page.

Is there something better I should use or look at (want the option of using
my own graphics for the numbers), or is there a way to get this counter to
increment only once per page per visit?

Thanks!!

--
Posted 'as is'. If there are any spelling and/or grammar mistakes, they
were a direct result of my fingers and brain not being synchronized or my
lack of caffeine.

Mike Brearley

Jul 19 '05 #1
2 1975
> my own graphics for the numbers), or is there a way to get this counter to
increment only once per page per visit?


You need a counter per page. I recommend handling this in a database, and
only incrementing each page once per sessionID. Then you only have to carry
around a sessionID in the session instead of all those tracking counters.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
Jul 19 '05 #2
Could you explain how to do that? I'm fairly new to this.

--
Posted 'as is'. If there are any spelling and/or grammar mistakes, they
were a direct result of my fingers and brain not being synchronized or my
lack of caffeine.

Mike Brearley
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:el**************@TK2MSFTNGP09.phx.gbl...
my own graphics for the numbers), or is there a way to get this counter to increment only once per page per visit?
You need a counter per page. I recommend handling this in a database, and
only incrementing each page once per sessionID. Then you only have to

carry around a sessionID in the session instead of all those tracking counters.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Earl Anderson | last post by:
KB Article Q140908 provided the following function to create an Auto Incrementing Counter: Function Next_Custom_Counter () On Error GoTo Next_Custom_Counter_Err Dim MyDB As Database Dim...
3
by: Dirk Reske | last post by:
Hello, I have following code:
9
by: Daniel Vukadinovic | last post by:
I want to implement an index/counter to my linked list. Why? I wrote a search function which searches the list for elements based on their values (say I add an element and I assign the value 54...
13
by: technocraze | last post by:
Hi guys, I have an issue with incrementing a counter in a table using VB in MS Acess environment. Below mentioned is an instance. Implementation logic Table fields Serialno = pk Datatype...
3
blackstormdragon
by: blackstormdragon | last post by:
Here were our instructions: "My mother always took a little red counter to the grocery store. The counter was used to keep tally of the amount of money she would have spent so far on that visit to...
4
by: WEG | last post by:
I want to create a custom counter to act as the primary field in a table but am having trouble with it. What I would like is a counter that shows the last two digits of the year, a hyphen, then...
1
by: senger.kim | last post by:
Hello World, I'm relatively new to MS Access (2003) and am trying to implement something that I feel should be simple but cannot find a solution. Hoping that you can help me or point me where to...
2
by: NJonge01 | last post by:
Hi, I use a counter in a subreport. The subreport is the primary data presentation for the report, and it covers more than 1 page. I use the OnFormat event of the Detail section to...
30
by: Paul W Smith | last post by:
I have written a hit counter, which I believe counts the times my page is hit by a user for each unique session by the user. The relevant part of my code is below: If...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.