首页 | 源码下载 | 网站模板 | 网页特效 | 广告代码 | 网页素材 | 字体下载 | 书库 | 站长工具
会员投稿 投稿指南 RSS订阅
当前位置:主页>网络编程>ASP教程>资讯:利用Asp生成整站静态

利用Asp生成整站静态

www.jz123.cn  2008-11-17   来源:   中国建站    袁袁整理    我要投递新闻

很多人在网说要全站转静态程序但是大多数都没结果的,所以小妹妹凭着一知半解的写了这个代码希望有了解 asp转静态技术 交流一下


QUOTE:
<%
  On Error Resume Next
  Server.ScriptTimeOut=9999999
  Function getHTTPPage(Path)
   t = GetBody(Path)
   getHTTPPage=BytesToBstr(t,"GB2312")
  End function
  Function GetBody(url)
   on error resume next
   Set Retrieval = CreateObject("Microsoft.XMLHTTP")
   With Retrieval
   .Open "Get", url, False, "", ""
   .Send
   GetBody = .ResponseBody
   End With
   Set Retrieval = Nothing
  End Function  
  Function BytesToBstr(body,Cset)
   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 = Cset
   BytesToBstr = objstream.ReadText
   objstream.Close
   set objstream = nothing
  End Function 
  Function Newstring(wstr,strng)
   Newstring=Instr(lcase(wstr),lcase(strng))
   if Newstring<=0 then Newstring=Len(wstr)
  End Function
%>

xmlhttp.asp


QUOTE:
<!--#include file="xmlhttp.asp"-->
<%
url="co.asp?id=2,"
wb_cx=PcMane(url)
                     IF wb_cx<>"" THEN
                     RESPONSE.Write("开始转换静态过程")
                     fso_wstr=split(wb_cx,",")
                            for i=0 to UBound(fso_wstr)-1
                            qman_html_min=(thhs(thhs(fso_wstr(i),"?","~"),".asp","")&".html")      
                            qman_html_min=getHTTPPage(http&fso_wstr(i))
                                   for j=0 to UBound(fso_wstr)-1
                                                 qman_html_min=thhs(qman_html_min,fso_wstr(j),thhs(thhs(fso_wstr(j),"?","~"),".asp","")&".html")
                                                 qman_html_min=thhs(qman_html_min,".html&",".html?")
                                   next
                                          Set fso = Server.CreateObject("Scripting.FileSystemObject")
                                                 FilePath = Server.MapPath(qman_html_url)
                                                        Set fout = fso.CreateTextFile(FilePath)

上一篇:ASP基础讲座(下) 下一篇:制作WEB在线编辑器-插入HTML标签

评论总数:1 [ 查看全部 ] 网友评论