[thelist] For the ASP Gurus...
Ken Kogler
ken.kogler at curf.edu
Sun Dec 9 02:04:32 CST 2001
This all executes within global.asa:
I've got 10 graphics in a folder, all named 01.gif - 10.gif.
I use the FSO to grab one at random and strip off the extension, leaving
just a number.
I assign the random number to a session variable.
I use this code to implement a random header graphic on my site. I'm
doing it this way since I don't want a random header for every page
load/refresh from every user. I just want every user to get a random one
for each session they start.
Problem is, every user is getting the same graphic every time.
Here's my global.asa:
-----------------------------------------------------------
Sub Session_OnStart
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(server.mappath("/images/headers/"))
For Each objFile in objFolder.Files
upperbound = objFile.name
Next
upperbound = split(upperbound,".")
session("topGraphic") = Int(Rnd() * cInt(upperBound(0))) + 1
set objFSO = nothing
set objFolder = nothing
End Sub
-----------------------------------------------------------
Any thoughts?
Thanks in advance...
~Ken K.
More information about the thelist
mailing list