现在的位置: 网页制作教程网站制作教程 >正文
asp语言高级教程

ASP生成HTML静态页面的实例源代码

发表于2017/4/1 网站制作教程 0条评论 ⁄ 热度 2,408℃

ASP生成HTML静态页面的实例源代码:

<%
'FilePath:生成静态页的文件名
'Do_Url:需要生成静态页的ASP文件
Private Sub CreateHtmlPage(FilePath,Do_Url)
FilePath=server.mappath(FilePath)
Dim objXmlHttp
Set objXmlHttp=Server.createObject("Microsoft.XMLHTTP")
objXmlHttp.open "GET",Do_Url,false
objXmlHttp.send()
Dim binFileData
binFileData=objXmlHttp.responseBody
Set objXmlHttp=Nothing
Dim objAdoStream
Set objAdoStream=Server.createObject("ADODB.Stream")
objAdoStream.Type=1
objAdoStream.Open()
objAdoStream.Write(binFileData)
objAdoStream.SaveToFile FilePath,2
objAdoStream.Close()
Set objAdoStream=nothing
End Sub
%>
<%
'以本站为例,把首页文件index.asp生成index.html
FilePath="index.html"
Do_Url="index.asp"
Call CreateHtmlPage(FilePath,Do_Url)
Response.Write("生成成功")
%>
  • 暂无评论