asp生成静态页 不指定

吕游 , 2007/06/15 11:43 , 综合栏目 » 实用代码 , 评论(0) , 阅读(1139) , Via 本站原创 | |

<%
dim strUrl,Item_Classid,id,FileName,FilePath,Do_Url,Html_Temp
Html_Temp="<UL>"

Html_Temp = Html_Temp&"<LI>"

FileName = "Index.html"
FilePath = Server.MapPath("/")&"\"&FileName
Html_Temp = Html_Temp&FilePath&"</LI>"
Do_Url = "http://"
Do_Url = Do_Url&Request.ServerVariables("SERVER_NAME")&"/index/index.asp"

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()
Html_Temp = Html_Temp&"<UL>"
%>
<%
Response.Write ( "成功生成文件:" )
Response.Write ( "<BR>" )
Response.Write Html_Temp
%>
将指定的ASP文件生成静态页面函数
<%
Function GetPage(url)
dim Retrieval
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False ', "", ""
.Send
GetPage = BytesToBstr(.ResponseBody)
End With
Set Retrieval = Nothing
End Function
Function BytesToBstr(body)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = "GB2312"
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function
on error resume next
Url="http://www.taiang.com.cn/index.asp"
response.write "开始更新首页..."
wstr = GetPage(Url)

Set fs=Server.CreateObject("Scripting.FileSystemObject")

'if not MyFile.FolderExists(server.MapPath("/html/")) then
'MyFile.CreateFolder(server.MapPath("/html/"))'
'end if

If (fs.FileExists(server.MapPath("./")&"\index.htm")) Then
fs.DeleteFile(server.MapPath("./")&"\index.htm")
End If

Set CrFi=fs.CreateTextFile(server.MapPath("./")&"\index.htm")
Crfi.Writeline(wstr)
set CrFi=nothing
set fs=nothing
response.write "...<font color=red>更新完成!</font>"
%>

作者:落叶知秋⊙吕游
地址:http://www.luckylvyou.com/read.php/207.htm
版权所有。转载时必须链接形式注明作者和原始出处及本声明!

最新日志 随机日志 综合排行
  • 自我评价
  • 记录我的QQ十年
  • 不做爱的羔羊
  • 这又是一个问答系统
  • 杯饮凄凉
  • 一朵心情
  • 超级感人:破产千万富翁高逸峰在...
  • 跟历史说再见
  • 仰望雨中的天
  • 博客为谁开
  • 不去打扰你哪份宁静
  • 江西南昌大学50位美女qq号大...
  • 看不清自己
  • 拐点
  • 郑州大商大人事件,我鄙视这些垃...
  • 教你最大限度地提高 Googl...
  • Google Adsense ...
  • 昨日故事
  • 值得借鉴的价值12万元的网站S...
  • 不再孤独之对自己好点!
  • Adsense电子在线支付截图
  • 谷歌对于“收购265.com”...
  • 郑智化-全部歌词
  • 小伟窗口放大器 1.5版本 C...
  • 李惠美 [电话小姐 ]鄙视此女
  • 港产美女张雅玲唯一一部激情影片...
  • 黄晓明版鹿鼎记下载
  • 《鹿鼎记》已经有7部了,及黄晓...
  • 江西南昌大学50位美女qq号大...
  • Camfrog Video C...
  • 中查看更多“asp生成静态页”相关内容
  • 中查看更多“asp生成静态页”相关内容
  • 中查看更多“asp生成静态页”相关内容
  • 中查看更多“asp生成静态页”相关内容
  • 中查看更多“asp生成静态页”相关内容
  • 中查看更多“asp生成静态页”相关内容
  • 发表评论

    昵称

    网址

    电邮

    打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]