最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp根据判断生成静态html页面代码
时间:2022-07-02 23:02:34 编辑:袖梨 来源:一聚教程网
<%
dim childType,Curl,childName,childUrl,localPath
childType = request.QueryString("childType")
select case childType
case "0"
Curl="http://www.111com.net /default.asp"
childName = "网站首页"
childUrl = "/index.html"
localPath = ""
case "1"
Curl="http://www.111cn.ne t/news/index.asp"
childName = "新闻中心首页"
childUrl = "/news/index.html"
localPath = "/news"
case "2"
Curl="http://www.111com.net /newhouse/index.asp"
childName = "新房网首页"
childUrl = "/newhouse/index.html"
localPath = "/newhouse"
case "3"
Curl="http://www.111com.net /home/index.asp"
childName = "家居网首页"
childUrl = "/home/index.html"
localPath = "/home"
case "4"
Curl="http://www.111com.net /hirehouses/index.asp"
childName = "租售网首页"
childUrl = "/oldhouse/index.html"
localPath = "/oldhouse"
case else
end select
Function FSOchange(filename,Target)
Dim objFSO,objCountFile,FiletempData,HtmlOut
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(Server.MapPath(filename),1,True)
FiletempData = objCountFile.ReadAll
objCountFile.Close
Set HtmlOut = objFSO.CreateTextFile (server.MapPath(Target))
HtmlOut.WriteLine FiletempData
HtmlOut.close
Set objFSO = Nothing
End Function
Dim fn,DoUrl,ObjXmlHttp,BinFileData,ObjAdoStream,filepath
filepath = localPath & "/index_.html"
fn = server.MapPath(filepath)
DoUrl = Curl
'Dourl = Request("Url")
set ObjXmlHttp = Server.CreateObject("MSXML2.serverXMLHTTP")
ObjXmlHttp.open "GET",DoUrl,false
ObjXmlHttp.send()
BinFileData = objXmlHttp.responseBody
set ObjAdoStream = Server.CreateObject("ADODB.Stream")
ObjAdoStream.Type = 1
ObjAdoStream.Open()
ObjAdoStream.Write(BinFileData)
ObjAdoStream.SaveToFile fn,2
ObjAdoStream.Close()
set ObjAdoStream = nothing
set objxmlhttp = nothing
call FSOchange(localPath & "/index_.html",localPath & "/index.html")
'使用FSO读取文件内容的函数
Function FSOFileRead(filename)
Dim objFSO,objCountFile,FiletempData
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(Server.MapPath(filename),1,True)
FSOFileRead = objCountFile.ReadAll
objCountFile.Close
Set objCountFile=Nothing
Set objFSO = Nothing
End Function
call Lib.tipText(0,"静态页面 " & childName & " 生成完毕 " & Now() & "")
response.Redirect(request.ServerVariables("HTTP_REFERER"))
%>