验证中...
Languages: ASP
Categories: Web开发技术
Latest update 2019-02-22 14:37
gistfile1.txt
Raw Copy
dim strUrl,Item_Classid,id,FileName,FilePath,Do_Url,Html_Temp,s_File
s_File = Request("file") '传入文件名参数,s_File
If s_File = "" Then
s_File = "index.asp"
End If
FileName = Replace(s_File,"asp","html")
FilePath = Server.MapPath(".")&"\"&FileName '设置静态页路径(我的是在主目录下建的admin文件夹)
Do_Url = left(fullpath(),len(fullpath())-10)&s_File
'response.write FilePath&"<br>"&Do_Url
'response.end
strUrl = Do_Url
dim objXmlHttp
'set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
set objXmlHttp = Server.CreateObject("MSXML2.XMLHTTP")
objXmlHttp.open "GET",strUrl,false
objXmlHttp.send()
Dim binFileData
binFileData = objXmlHttp.responseBody
'binFileData=BytesToBstr(binFileData,"utf-8")
'binFileData=cstr(binFileData)
Dim objAdoStream
set objAdoStream = Server.CreateObject("ADODB.Stream")
objAdoStream.Type = 1
'上面这个1是二进制,2是文本'
objAdoStream.Open()
objAdoStream.Write(binFileData)
objAdoStream.SaveToFile FilePath,2
objAdoStream.Close()
response.write "静态首页成功生成!"

Comment list( 1 )

志哥 2019-02-22 14:37

Function fullPath()
dim str,host,url,keyword,full
str = "http://"
host = Request.ServerVariables("HTTP_HOST")
url = Request.ServerVariables("PATH_INFO") 'url
keyword = Request.ServerVariables("QUERY_STRING")
if keyword <> "" then
fullPath = str&host&url&"?"&keyword
else
fullPath = str&host&url
end if
end Function

You need to Sign in for post a comment

Help Search

183227_9af5e6a8_1826025 111910_4d91f001_1826025