Function GetBody(weburl)
'创建对象
Dim ObjXMLHTTP
Set ObjXMLHTTP=Server.CreateObject("MSXML2.serverXMLHTTP")
'请求文件,以异步形式
ObjXMLHTTP.Open "GET",weburl,False
ObjXMLHTTP.send
While ObjXMLHTTP.readyState <> 4
ObjXMLHTTP.waitForResponse 1000
Wend
'得到结果
GetBody=ObjXMLHTTP.responseBody
'释放对象
Set ObjXMLHTTP=Nothing
End Function
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
<%
'For Each r In Request.QueryString
If RegExpTest("[%<>\s';]+",Request.QueryString) then
Response.Write("<script language='javascript'>alert('信息有误!');</script>")
Response.End()
end If
'Next
'vbscript正则表达式测试方法
function RegExpTest(patrn, strng)
Dim regEx ' 建立变量。
Set regEx = New RegExp ' 建立正则表达式。
regEx.Pattern = patrn ' 设置模式。
regEx.IgnoreCase = False ' 设置是否区分大小写。
RegExpTest = regEx.Test(strng) ' 执行搜索测试。
end Function
%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
FilePath = Server.MapPath("/")&"/index.htm"
'response.Write(FilePath)
Do_Url = "http://"
Do_Url = Do_Url&Request.ServerVariables("SERVER_NAME")&"/default.aspx"
strUrl = Do_Url
'response.Write(strUrl)
dim objXmlHttp
set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
objXmlHttp.open "GET",strUrl,false
objXmlHttp.send()
Dim binFileData
binFileData = objXmlHttp.responseBody
Dim objAdoStream
set objAdoStream = Server.CreateObject("ADODB.Stream")
objAdoStream.Type = 1
objAdoStream.Open()
objAdoStream.Write(binFileData)
objAdoStream.SaveToFile FilePath,2
objAdoStream.Close()
Response.Write("<script language=javascript>alert('首页静态转换成功!');</script>")
%>