<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
'Functions that read remote files
Public Function readRemoteFile(RemoteDataUrl)
Dim XMLHttp
'On Error Resume Next
Set XMLHttp = ("")
With XMLHttp
.Open "Get", RemoteDataUrl, False
.Send
readRemoteFile = BytesToBstr(.responseBody, "UTF-8")
End With
Set XMLHttp = Nothing
End Function
'Encoding conversion
Function BytesToBstr(body,Cset)
dim objstream
set objstream = ("")
= 1
=3
body
= 0
= 2
= Cset
BytesToBstr =
set objstream = nothing
End Function
Function tobody()
Dim dateVal
'Try to access the cache first to see if there is, or if it is expired
dateVal = Application("defaultdate")
If dateVal = "" Then dateVal = DateAdd("s",1200,Now)
If Application("default") <> "" Then
If DateDiff("s", Now, dateVal) > 0 Then
'If there is, read from the cache, for the server, it is read from the memory
tobody = Application("default")&"<!--new cache"&dateVal&"-->"
Exit Function
End If
End If
Dim body
'If the cache does not exist, read from remotely and write to the cache, setting the cache time.
body = readRemoteFile("/")
tobody = body&"<!--made cache"&Now&"-->"
Application("default") = body
Application("defaultdate") = DateAdd("s",1200,Now)
End Function
(tobody())
%>