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("生成成功")

%>

声明:如需转载,请注明来源于www.webym.net并保留原文链接:http://www.webym.net/jiaocheng/881.html

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐