<%@ Language=VBScript %> <%Option Explicit Response.Buffer=True Response.CacheControl = "no-cache" On Error Resume Next dim PAGE_NAME PAGE_NAME = "default.asp"%> <% dim objFSO dim objFolder dim objFileList dim objTextStream dim file dim randomNum dim count dim chosenFile dim path dim strReadAll dim constForReading constForReading = 1 path = constPHYSICAL_PATH & "splash" set objFSO = CreateObject("Scripting.FileSystemObject") set objFolder = objFSO.GetFolder(path) set objFileList = objFolder.Files 'To produce random integers in a given range, use this formula 'CInt(Int((upperbound - lowerbound + 1) * Rnd() + lowerbound)) Randomize randomNum = CInt(Int(objFileList.Count * Rnd())) count = 0 For Each file In objFileList If count = randomNum Then chosenFile = CStr(file.Name) End If count = count + 1 Next set objTextStream = objFSO.OpenTextFile(path & "\" & chosenFile, constForReading) strReadAll = objTextStream.ReadAll set objTextStream = nothing set objFSO = nothing set objFolder = nothing set objFileList = nothing %> <%=strReadAll%>