当前时间:2025/5/4 18:15:05 首页 三千年史话 官方微信 联系我们
 
 
商书策管理咨询 你的心中有个帝国,商书策
用中国的管理优化世界
决战天球商业模拟 管理人员培训系统
专注于精益管理、流程变革咨询、管理人员训战 专线:135 2150 9118
 
   
     
  商书策管理咨询  
     
 
商书策管理咨询
  制造业精益解决方案
  服务业精益解决方案
  近期典型客户案例
  名家观点
 
ASP转HTML最优方案 最简单实现代码
 
  经过N多次的测试实验,最终发现这中方式的静态处理使用代码最少,过程最简单。而且适用范围很大。。。

<%
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.huiyi-r.com/index.asp"'要读取的页面地址
response.write "开始更新首页..."
wstr = GetPage(Url)

'response.write(wstr)
Set fs=Server.CreateObject("Scripting.FileSystemObject")

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

'要存放的页面地址
dizhi=server.MapPath("1111.htm")
If (fs.FileExists(dizhi)) Then
fs.DeleteFile(dizhi)
End If

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

 
 
   
  点这里评论  
   
 
 
集团分站:豪聘网 五略商书网 商帝国商务网 五略文学网
商书策管理咨询 版权所有 北京市海淀区温泉镇创客小镇社区配套商业楼15#楼一层106室 135 2150 9118 京ICP备2022021022号