Well, here's my thinking. You can add another application variable like this.
Code:
<%
Sub Application_OnStart
Application("pagehits") = 0
Application("pageindex") = 0
End Sub
%>
Then modify the code in the frameset like this.
Code:
<%
dim pageCount
pageCount = 10
dim pageList(pageCount)
pageList(0) = "page1.asp"
pageList(1) = "page2.asp"
pageList(2) = "page3.asp"
pageList(3) = "page4.asp"
pageList(4) = "page5.asp"
pageList(5) = "page6.asp"
pageList(6) = "page7.asp"
pageList(7) = "page8.asp"
pageList(8) = "page9.asp"
pageList(9) = "page10.asp"
IF Application("pagehits") > 50 THEN
Application.Lock
Application("pagehits") = 0
IF Application("pageindex") >= pageCount-1 THEN
Application("pageindex") = 0
ELSE
Application("pageindex") = Application("pageindex") + 1
END IF
Application.Unlock
ELSE
Application.Lock
Application("pagehits") = Application("pagehits") + 1
Application.Unlock
END IF
dim i
i = Application("pageindex")
pageref = pageList(i)
%>
<frame name="lowerframe" src="<%=pageref%>" ....>
Do you see what we've done there. Basically we added another application counter. It represents what page we're currently loading into the frameset. It's initialized at zero, so for the first 50 loads, that variable stays at zero. Now we create an array of pages called pageList() and in the last line of ASP code, we call the page assigned to the number in the application counter
pageref = pageList(i). In this case,
i represents
0 until that counter is incremented.
Here's what you need to know and understand. If you increase or decrease the number of pages, you need to make that change in two places.
pageCount = x and then you'll need to modify the list. Now, the sort of tricky part is that VBScript arrays are zero based. So while you have 10 pages, the array starts at zero (and so does our counter). So for 10 pages, you actually have an array indexed 0-9. You can also see where I'm calling the
pageCount variable in the conditional statement that increments the
Application("pageindex"
value. Notice how I set it to be
pageCount-1. That's because of the zero based indexing. We want it to go back to zero if the pageindex is at
9 and someone has already loaded the frameset 50 times.
Is that making sense.
ToddWW