下面的例子是将、index.asp?id=1/index.asp?id=2/index.asp?id=3/这三个动态页面,分别生成ndex1.htm,index2.htm,index3.htm存在根目录下面:
<% dim strUrl,Item_Classid,id,FileName,FilePath,Do_Url,Html_Temp Html_Temp="<UL>" For i=1 To 3 Html_Temp = Html_Temp&"<LI>" Item_Classid = i FileName = "Index"&Item_Classid&".htm" FilePath = Server.MapPath("/")&"\"&FileName Html_Temp = Html_Temp&FilePath&"</LI>" Do_Url = "http://" Do_Url = Do_Url&Request.ServerVariables("SERVER_NAME")&"/main/index.asp" Do_Url = Do_Url&"?Item_Classid="&Item_Classid strUrl = Do_Url dim objXmlHttp set objXmlHttp = Server.createObject("Microsoft.XMLHTTP") objXmlHttp.open "GET",strUrl,false objXmlHttp.send() Dim binFileData binFileData = objXmlHttp.responseBody Dim objAdoStream set objAdoStream = Server.createObject("ADODB.Stream") objAdoStream.Type = 1 objAdoStream.Open() objAdoStream.Write(binFileData) objAdoStream.SaveToFile FilePath,2 objAdoStream.Close() Next Html_Temp = Html_Temp&"<UL>" %> <% Response.Write ( "成功生成文件:" ) Response.Write ( "<BR>" ) Response.Write Html_Temp %>