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

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐