CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  ASP

高分100请教动态生成静态html页面问题?实现立即给分,在线等!!!

楼主shuli365()2006-06-03 09:16:08 在 Web 开发 / ASP 提问

http://www.yatai100.com/offer/目录下的文件如下:  
   
  /offer/Add_order.asp  
  /offer/BookDetails.asp  
  /offer/BookList.asp  
  /offer/default.asp  
  /offer/GoodBook.asp  
  /offer/Ohmycart.asp  
  /offer/order_ok.asp  
  /offer/righttree.asp  
  /offer/SearchOrder.asp  
  (以上文件打包在http://www.yatai100.com/offer/offer.rar下)  
  可见在offer目录下没有一个html页面,但是在这个网站地址http://www.sinoef.com/offer/下的页面里面的所有书籍全是静态页面(可以打开),同样的程序,为什么在http://www.yatai100.com/offer/目录下就不能呢?  
  如:http://www.yatai100.com/offer/页面里的新书推荐下的设计理念http://www.yatai100.com/offer/Book175.html就打不开,而http://www.sinoef.com/offer/Book175.html就能打开,这是为什么呀?  
   
  哪位大侠,高手帮帮小弟呀!在次先谢了,敬等指点迷津!!! 问题点数:100、回复次数:28Top

1 楼sunshift(http://www.56390.com/)回复于 2006-06-03 09:18:39 得分 0

FSO   +   XMLHTTPTop

2 楼shuli365()回复于 2006-06-03 09:23:13 得分 0

楼上的大哥能不能说的详细点!Top

3 楼shuli365()回复于 2006-06-03 09:24:58 得分 0

是不是服务器上安装什么组件啊?  
  Top

4 楼cpio(备注)回复于 2006-06-03 09:26:23 得分 0

 
  已经是静态的了啊  
  Top

5 楼niewenmin(WinMan)回复于 2006-06-03 09:29:32 得分 0

帮你顶下了!Top

6 楼chinastorm(JOBS.CN)回复于 2006-06-03 09:32:45 得分 0

http://www.sinoef.com/offer/底下应该还有别的文件吧Top

7 楼shuli365()回复于 2006-06-03 09:34:18 得分 0

cpio(Cplus@hit.edu.cn)     这位大哥能不能详细点,  
   
  http://www.yatai100.com/offer/目录下没静态文件  
   
  可是在http://www.yatai100.com/offer/页面里的ttp://www.yatai100.com/offer/Book175.html就可以打开  
   
  在http://www.yatai100.com/offer/Book175.html   就打不开  
   
  Top

8 楼shuli365()回复于 2006-06-03 09:38:45 得分 0

http://www.sinoef.com/offer/   下面没别的文件了。  
   
  我上哪服务器看了很多遍了,而且不只是在offer目录下有这样的情况   在别的目录下也有这样的情况.  
   
  如:  
  http://www.yatai100.com/Mall/Street.asp   页面的商品全都打不开   在http://www.sinoef.com/Mall/Street.asp   就都可以打开  
  Mall/目录下也没有HTML   文件Top

9 楼liuxiaoyi666(MSMVP 小猪妹荣誉马甲之八卦兔子)回复于 2006-06-03 09:48:36 得分 0

你的服务器??iis可以设置出来的,把文件夹禁止....Top

10 楼bino(冰叶)回复于 2006-06-03 09:54:18 得分 0

<%      
  i=cint(request("id"))'新闻ID  
  page=trim(request("page"))'源ASP文件名  
  html=trim(request("html"))'生成目标HTML文件名  
  num=cint(request("num"))'1目标HTML文件名后面加数字   0目标HTML文件名后面不加数字  
     
  '常用函数      
  '1、输入url目标网页地址,返回值getHTTPPage是目标网页的html代码      
  function     getHTTPPage(url)      
  dim     Http      
  set     Http=server.createobject("MSXML2.XMLHTTP")      
  Http.open     "GET",url,false      
  Http.send()      
  if     Http.readystate<>4     then          
  exit     function      
  end     if      
  getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")      
  set     http=nothing      
  if     err.number<>0     then     err.Clear          
  end     function      
     
  '2、转换乱玛,直接用xmlhttp调用有中文字符的网页得到的将是乱玛,可以通过adodb.stream组件进行转换      
  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      
     
  txtURL=server.MapPath("../index.asp")      
     
  sText     =     getHTTPPage(txtURL)          
     
  Set     FileObject=Server.CreateObject("Scripting.FileSystemObject")          
  filename="../index.htm"      
  Set     openFile=FileObject.OpenTextfile(server.mapPath(filename),2,true)     'true为不存在自行建立      
  openFile.writeline(sText)      
  Set     OpenFile=nothing      
     
  %>      
  <script>      
  alert("静态网页生成完毕");      
  history.back();      
  </script>Top

11 楼bino(冰叶)回复于 2006-06-03 09:55:55 得分 0

因为这是用adodb.stream来写文件的  
  可能卡巴斯基等某些杀毒软件会把它当病毒杀掉  
  用的时候关掉就是了..Top

12 楼shuli365()回复于 2006-06-03 10:10:40 得分 0

http://www.yatai100.com   服务器上什么防毒软件也没装!不能是病毒杀掉  
  Top

13 楼yidc(天下)回复于 2006-06-03 10:18:42 得分 0

结贴了没有?Top

14 楼keya(守望者)回复于 2006-06-03 10:19:20 得分 0

<!--   #INCLUDE   file="../conn.asp"   -->  
   
  <%  
   
  On   Error   Resume   Next'容错处理  
  Dim   sql'搜索字符串,这里我就直接打开表不用搜索变量了,搜索条件按自己写就可以  
  sql="select   *   from   cc_new   where   id="&request("id")  
  Dim   Rs'数据操作对象  
  Set   Rs   =   Server.CreateObject("ADODB.Recordset")  
  Rs.Open   Sql,Conn,1,1'找开酒店等于City变量的表  
  Dim   fs'定义fso文件对象  
  Dim   folders'存放生成静态页的文件夹名称  
  Dim   Filestart'定义生成htm文件前缀  
  Set   fs=Server.CreateObject("Scripting.FileSystemObject")  
  Dim   i  
   
  folders=server.mappath("/news/html/"&year(rs("new_Date"))&"-"&month(rs("new_Date"))&"")  
  if   (fs.FolderExists(folders))   then'判断文件夹是否存在  
  else  
  fs.CreateFolder(folders)'不存在则创建CityHtml文件夹  
  end   if  
  Filestart=rs("id")'如果为第一页则定义文件名为传值名.例如beijing则为beijing.htm  
   
  Dim   files'定义生成文本文件名称变量  
  Dim   filez'定义文件路径名称变量  
  files=Filestart&".html"'本文件名称  
   
  filez=folders&"/"&files'文本文件路径  
   
  '册除文件  
  Dim   checkfile'检查文本文件是否已经存在,是则删除  
  checkfile=server.mappath(folders&"/"&Filestart&".html")'检查htm文件是否已经存在,是则删除  
  response.Write(checkfile)  
  if   (fs.FileExists(checkfile))   then'检查htm文件是否已经存在,是则删除  
  Dim   df'定义文件对象*删除文件使用*  
  Set   df=fs.GetFile(checkfile)'定义要册除的文件  
  df.delete'册除文件  
  end   if'判断结束  
  Dim   ts'定义写入文件对象  
  set   ts   =   fs.createtextfile(filez,true)   '开启写入文件内容**我在正文只简单写入酒店名称和静态数字分页显示**  
   
  页面代码:  
  bb="<table   width='760'   border='0'   align='center'   cellpadding='0'   cellspacing='0'>"&vbcrlf  
  bb=bb&"<tr><td   height='33'   colspan='2'   background='/images/top_bg.gif'>"&vbcrlf  
  bb=bb&"<table   width='100%'   border='0'   cellspacing='0'   cellpadding='0'><tr>"&vbcrlf  
  bb=bb&"   <td   width='69%'   height='28'><table   border='0'   align='center'   cellpadding='2'   cellspacing='0'><tr>"&vbcrlf  
  bb=bb&"<td>"&vbcrlf  
   
   
  ts.write(bb)  
  ts.close  
  set   ts=nothing   '释放对象  
  Dim   EditFile'定义改写文件变量  
  Set   EditFile   =   fs.GetFile(filez)'设置改写文件对象  
  EditFile.name=   left(EditFile.name,len(EditFile.name)-4)&".htm"   '改写文本文件  
  set   EditFile=nothing   '释放对象  
  set   fs=nothing'释放对象  
  Top

15 楼shuli365()回复于 2006-06-03 10:19:26 得分 0

liuxiaoyi666(MSMVP小猪妹马甲之八卦兔子),你说的能不能详细点啊?麻烦你了  
  Top

16 楼keya(守望者)回复于 2006-06-03 10:19:37 得分 0

可以,我现在就是用的这种方法!Top

17 楼liuxiaoyi666(MSMVP 小猪妹荣誉马甲之八卦兔子)回复于 2006-06-03 10:28:29 得分 0

在iis中点开所在网站,右键点所在文件夹,把读取去掉,就出了你现在的效果了Top

18 楼shuli365()回复于 2006-06-03 10:36:17 得分 0

IIS   有读取权限的,请你好好看一下问题。谢谢啦Top

19 楼shuli365()回复于 2006-06-03 22:28:53 得分 0

那位能解决啊!我连给分,带给现金,RMB100元  
  知道的联系袄!  
  电话:024-82631199         E-mail:jinri365@126.com      
  联系人:金日Top

20 楼angelyujun(搁浅的鱼@南昌大学)回复于 2006-06-04 10:04:21 得分 0

这个太简单了,先用asp生成你静态页面的html,再用fso.CreateTextFile创建一个html文件,之后把你生成的html写入这个html页面即可,  
   
  楼主给我现金哦,angelyujun@hotmail.comTop

21 楼shuli365()回复于 2006-06-04 10:19:00 得分 0

请angelyujun(搁浅的鱼@南昌大学)   好好看看问题!你在下载下压缩的文件看一下,里面一个HTML   也没有。  
   
  提示大家一下可能和ISAPI有关系!  
  ISAPI_Rewrite(模拟静态页面)  
  具体我就不明白拉,请高手指点。现金一定给,分也给.....Top

22 楼zhan075(红心蓝岛)回复于 2006-06-04 12:52:00 得分 0

A_create_htm.asp   页面  
   
  <!--#include   file="conns.asp"-->  
  <!--#include   file="Funindex.asp"-->  
  <%  
  set   wy=new   wyclass  
  if   not   islogin   then  
    call   Wy.Error("对不起,你没有登入,或闲置时间过长,请重新登入!",9)  
    response.end  
  end   if  
  %>  
  <%  
  Function   FunMsg(StrMSG,StrURL)  
  Response.write   "<script   language='javascript'>"&_  
  Vbcrlf&"alert("""&StrMSG&""");"&_  
  Vbcrlf&"window.location="""&StrURL&""";"&_  
  Vbcrlf&"</script>"  
  End   Function  
  Function   CheckPower(IntNumber)  
  if   Instr(session("StrPowerNumber"),IntNumber)=0   then  
  call   FunErr("对不起你没有相应管理权限!|",false)  
  end   if  
  end   Function  
  function   FunErr(Strmessige,Blotype)  
  if   Blotype   then  
  if   not   isnull(Strmessige)   then  
  dim   Strarraymsg,intFunErr  
  Strarraymsg=split(Strmessige,"|")  
  for   intFunErr=0   to   ubound(Strarraymsg)-1  
  FunErr=FunErr   &   "<li></li><font   color='#CC3300'>"   &   Strarraymsg(intFunErr)   &   "</font><br>"  
  next  
  else  
  exit   function  
  end   if  
  else  
  response.redirect("Error.asp?err="&server.URLEncode(Strmessige))  
  response.end  
  end   if  
  end   function  
  Function   Fundate(strdate)  
  Fundate=strdate  
  Fundate=Replace(FormatDateTime(Fundate,2),"-","/")  
  End   Function  
   
  Dim   action  
  action=request("action")  
  select   case   action  
  case   "index_edit"  
  call   index_edit()'-------------首页模板修改----------  
  case   "index_create"  
  call   index_create()'-------------首页生成网页----------  
  case   else  
  call   index_create()  
  End   select  
   
  '***********************首页模板修改********************  
  function   index_edit()  
  dim   rs  
  set   rs=server.createobject("adodb.recordset")  
  rs.open   "select   T_index   from   R_mb",conn,2,3  
  rs("T_index")=request("T_index")  
  rs.update  
  rs.close:set   rs=nothing  
  call   funMsg("首页模板修改成功!","csindex.asp")  
  End   function  
  '***************************结   束***********************  
  '***********************首页生成网页********************  
  Function   index_create()  
   
  dim   savepath,fso,T_index  
  savepath=server.mappath("../")  
  set   rsT=server.createobject("adodb.recordset")  
  rst.open   "select   T_index,datatime   from   R_mb",conn,1,2  
  rst("datatime")=date()  
  rst.update  
  set   Fso=server.createobject("Scripting.FileSystemObject")  
  '-----------------------------------  
  T_index=rsT("T_index")  
  T_index=replace(T_index,"$index1$",index1)  
  T_index=replace(T_index,"$index2$",index2)  
  T_index=replace(T_index,"$index3$",index3)  
  '生存静态文件  
  Set   Fileobject=   Fso.createtextfile(savepath&"\index"&".htm",true)  
  Fileobject.write   T_index  
  rst("datatime")=now()  
  rst.update  
  rsT.close:set   rsT=nothing  
  if   err.number<>0   then  
  call   FunErr("生成新闻时产生了错误!|",false)  
  else  
  call   funmsg("首页页面生成成功!","csindex.asp")  
  end   if  
   
  end   function  
  '***************************结   束***********************  
  %>  
   
   
  Funindex.asp页面  
   
   
  <%  
  dim   index1  
  index1=""  
  StrSql="select   top   5   *   from   News   where   NewsType   in(222,223)   order   by   id   desc   "  
  Set   Rs=Server.CreateObject("Adodb.RecordSet")  
  Rs.Open   StrSql,Conn,1,1  
  Do   While   Not   Rs.Eof  
  y=y+1  
  index1=index1&"<tr><td   width=""89%""   height=""25""   class=""news"">     <img   src=""images/index_54.jpg""   width=""5""   height=""10""   align=""middle"">"  
  index1=index1&"<A   href='newsck.asp?sid="&rs("id")&"'     title="&rs("title")&"   class=noy>"&   left(rs("title"),17)&"</A>"  
  index1=index1&"</td><td   width=""11%""   class=""news"">"  
  if   y<4   then  
  index1=index1&"<img   src=""images/index_56.jpg""   width=""21""   height=""14"">"  
  end   if  
  index1=index1&"</td></tr>"  
  Rs.MoveNext  
  Loop  
  Rs.Close:Set   Rs=Nothing  
  dim   index2  
  index2=""  
  StrSql="select     top   5   *   from   news   where   NewsType=30   and   Other1='1'   order   by     pid   asc   "  
  Set   Rs=Server.CreateObject("Adodb.RecordSet")  
  Rs.Open   StrSql,Conn,1,1  
  Do   While   Not   Rs.Eof  
  index2=index2&"<td   width=""25%""   align=""center""><a   href=""cgal.asp""   target=""_blank""><img   src="""&rs("Other2")&"""   width=""128""   height=""77""   class=""pic_outline""   border=""0""></a></td>"  
  Rs.MoveNext  
  Loop  
  Rs.Close:Set   Rs=Nothing  
   
  dim   index3  
  index3=""  
  StrSql="select   *   from   class_download     order   by   DescID   "  
  Set   Rs=Server.CreateObject("Adodb.RecordSet")  
  Rs.Open   StrSql,Conn,1,1  
  Do   While   Not   Rs.Eof  
  index3=index3&"document.write('<TR><TD   vAlign=center   align=middle   background=./top/middle.gif><table   border=0   width=""100%""   cellspacing=""0""   cellpadding=""0""   id=""table1""><tr>"  
  index3=index3&"<td   align=""center""><A     href=""http://wpa.qq.com/msgrd?V=1&Uin="&rs("img")&"&Site=顺大网络技术有限公司&Menu=no""   title=""在线即时交谈""   target=blank><span   style=""font-size:   9pt""><IMG   alt=点击这里给我发消息     src=""./top/8_online.gif""     border=0></span></A>"  
  index3=index3&"<span   style=""font-size:   9pt"">   </span>   </td><td   align=""center""   width=""74""><p   align=""left""><A     href=""http://wpa.qq.com/msgrd?V=1&Uin="&rs("img")&"&Site=在线咨询&Menu=no""   title=""在线即时交谈""   target=blank>"  
  index3=index3&"<font   color=""#FF0000""   style=""font-size:   9pt"">"&rs("name")&"</font></a></td></tr></table></TD><TD   vAlign=center   align=middle   background=./top/middle.gif></TD></TR>');"  
  Rs.MoveNext  
  Loop  
  Rs.Close:Set   Rs=Nothing  
   
  %>        
  Top

23 楼zhan075(红心蓝岛)回复于 2006-06-04 12:53:53 得分 0

csindex.asp页面  
   
  <!--#include   file="../inc/WyMain_Class.asp"-->  
  <!--#include   file="conns.asp"-->  
  <%  
  set   wy=new   wyclass  
  if   not   islogin   then  
    call   Wy.Error("对不起,你没有登入,或闲置时间过长,请重新登入!",9)  
    response.end  
  end   if  
  %>  
  <html>  
  <head>  
  <title>管理</title>  
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">  
  <style>  
  td                 {FONT-SIZE:   9pt;   COLOR:   #000000;   FONT-FAMILY:   Tahoma;}  
  BODY             {SCROLLBAR-SHADOW-COLOR:   #595959;   COLOR:   #7B7D7B;   SCROLLBAR-3DLIGHT-COLOR:   #595959;   SCROLLBAR-ARROW-COLOR:   #595959;   FONT-FAMILY:   verdana,??,   Seoul,   Gulim;   SCROLLBAR-DARKSHADOW-COLOR:   #ffffff;   SCROLLBAR-BASE-COLOR:   #efefef;   LETTER-SPACING:   -1px}  
  A                   {COLOR:   #000000;   TEXT-DECORATION:   none;}  
  A:hover       {COLOR:   #000000;   TEXT-DECORATION:   none}  
  td                 {COLOR:   #000000;   font-size:   12px;   FONT-FAMILY:   verdana;}  
  td.a             {COLOR:   blue;   font-size:   12px;   FONT-FAMILY:   verdana;}  
  input           {FONT-SIZE:   12px;   COLOR:   #000000;}  
  input.a,select       {FONT-FAMILY:   verdana;   BORDER-RIGHT:   #cccccc   1px   solid;   BORDER-TOP:   #cccccc   1px   solid;   FONT-SIZE:   9pt;   BORDER-LEFT:   #cccccc   1px   solid;   COLOR:   red;   BORDER-BOTTOM:   #cccccc   1px   solid;   BACKGROUND-COLOR:   #ffffff}  
  .bg               {background-repeat:   no-repeat;   background-position:   right   bottom;   background-image:   url(images/bg5.jpg);   background-attachment:   scroll}  
  .name   {  
  font-family:   "宋体";  
  font-size:   12px;  
  line-height:   18px;  
  color:   #A09C9C;  
  }</style>  
  </head>  
  <body   topmargin=3   leftmargin=0   class=bg>  
  <%  
  dim   rs,sql  
  set   rs=server.createobject("adodb.recordset")  
  sql="select   *   from   R_mb"  
  rs.open   sql,conn,1,1  
  %>  
  <script   language="javascript">  
    function   htmlsubmit(action){  
      if   (confirm("你确定要这样操作吗?")){  
    html.action="A_create_htm.asp?action="+action+"";  
  html.submit();  
  }  
  }  
  </script>  
                  <form   method="post"   name="html">  
  <table   cellpadding=0   cellspacing=0   border=0   width=97%   align=center   height=100%>  
      <tr><td   height=20><font   color=#ff0000>网站管理</font>   >>   生成静态首页     </td></tr>  
      <tr><td   height=1   bgcolor=#cecfce></td></tr>  
      <tr><td   height=20></td></tr>  
      <tr><td     align="center"height=20>模板代码</td></tr>  
        <tr   bgcolor="#FFFFFF">  
              <td   height="22"     ><div   align="right"   class="name">最后一次生成页面:<%=rs("datatime")%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div></td>  
          </tr>  
          <tr><td   align=center>  
                      <textarea   name="T_index"     style="width:630px;   height:350px"><%=rs("T_index")%></textarea>  
  </td>  
  </td></tr>  
  <tr   bgcolor="#FFFFFF"   >  
                      <td   align="center"><input   type="button"   name="Submit"   value="   修改模板   "   onclick="htmlsubmit('index_edit')">  
                        &nbsp;&nbsp;     <input   type="button"   name="Submit"   value="   生成网页   "   onclick="htmlsubmit('index_create')"></td>  
                  </tr>  
   
          <tr   bgcolor="#FFFFFF">  
              <td   height="22"     ><div   align="right">   </div></td>  
          </tr>  
              </form>  
  </table>Top

24 楼love01px(JAVA CUP)回复于 2006-06-04 14:23:23 得分 0

用的是Rewrite  
  如果服务器支持URL   Rewrite  
  ISAPI_Rewrite.dll  
  配置一下URL   rewrite  
   
  RewriteRule   /offer/Book(\d+)\.html   /offer/BookDetails\.asp\?id=$1Top

25 楼love01px(JAVA CUP)回复于 2006-06-04 14:35:00 得分 100

服务器安装ISAPI_Rewrite后(http://www.isapirewrite.com/)  
  编辑httpd.ini  
   
  增加  
  RewriteRule   /offer/Book(\d+)\.html   /offer/BookDetails\.asp\?id=$1  
  Top

26 楼shuli365()回复于 2006-06-04 14:39:22 得分 0

问提已经解决,有位论坛里的叫dongfangbai的打电话告诉我了.正好他是沈阳的,他直接来我们公司处理了.Top

27 楼shuli365()回复于 2006-06-04 14:41:15 得分 0

楼上的love01px(JAVA   CUP),说的很正确,100分给他了,另外dongfangbei不要钱,我请他吃饭~!Top

28 楼long171()回复于 2006-06-05 16:34:07 得分 0

用FileSystemObject中的文本流对象就可以做出来.    
  Top

相关问题

关键词

得分解答快速导航

  • 帖主:shuli365
  • love01px

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo