首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

同志们帮小弟我看看是不是里面有不正常的代码?(ASP)

2012-02-10 
同志们帮我看看是不是里面有不正常的代码?(ASP)同志们帮我看看是不是里面有不正常的代码?%@LANGUAGE VB

同志们帮我看看是不是里面有不正常的代码?(ASP)
同志们帮我看看是不是里面有不正常的代码?

<%@LANGUAGE= "VBSCRIPT "   CODEPAGE= "936 "%>
<!--#include   file= "../conn.asp "   -->
<html>
<head>
<title> 文件管理_文件下载! </title>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<link   href= "../style.css "   rel= "stylesheet ">
</head>
<body>

<%call   downloadFile(replace(replace(Request( "filename "), "\ ", " "), "/ ", " "))     '调用过程
Function   downloadFile(Filename)    
  Filepath   =server.MapPath( "downloadfile ")& "\ "&   Filename
  Response.Buffer   =   True    
  Response.Clear    
  '创建Stream对象
  Set   Objstream   =   Server.CreateObject( "ADODB.Stream ")    
  Objstream.Open    
  '数据类型为二进制
  Objstream.Type   =   1    
  on   error   resume   next    
  '检查文件是否出错
  Set   Objfile   =   Server.CreateObject( "Scripting.FileSystemObject ")    
  if   not   Objfile.FileExists(Filepath)   then     %>
    <table   width= "560 "   height= "395 "   border= "0 "   cellpadding= "-2 "   cellspacing= "-2 "
      background= "../images/file/download.gif ">
    <tr>
        <td   width= "510 "   valign= "top "> <table   width= "100% "   height= "137 "     border= "0 "  
cellpadding= "-2 "   cellspacing= "-2 ">
            <tr>
                <td   height= "121 "> &nbsp; </td>
            </tr>
        </table>            
        <table   width= "83% "   height= "214 "     border= "0 "   align= "center "   cellpadding= "-2 "   cellspacing= "-2 ">
            <tr>
                <td   height= "91 ">
<%   Response.Write( "错误提示: <p> "   &   Filepath   &   "   不存在! <p> ")   %> </td>
            </tr>
            <tr>
              <td> <div   align= "center "> <br>
<form   name= "form1 "   >
    <input   name= "myclose2 "   type= "button "   class= "Style_button_del "   id= "myclose2 "
  value= "关闭窗口 "   onClick= "javascrip:window.close() ">
</form>
</div> </td>
              </tr>
            </table>


        </td>
    </tr>
</table>
  <%
  Response.End()  
  end   if    
  '获取文件的大小
  Set   myfile   =   Objfile.GetFile(Filepath)    
  intFilelength   =   myfile.size    
  Objstream.LoadFromFile(Filepath)    
  if   err   then     %>
    <table   width= "560 "   height= "395 "   border= "0 "   cellpadding= "-2 "   cellspacing= "-2 "
      background= "../images/file/download.gif ">
    <tr>
        <td   width= "510 "   valign= "top "> <table   width= "100% "   height= "131 "     border= "0 "
  cellpadding= "-2 "   cellspacing= "-2 ">
            <tr>
                <td   height= "120 "> &nbsp; </td>
            </tr>
        </table>            
                <table   width= "83% "   height= "189 "     border= "0 "   align= "center "   cellpadding= "-2 "   cellspacing= "-2 ">
                    <tr>
                        <td   height= "91 ">
<%   Response.Write( "错误提示: <p>   "   &   err.Description   &   " <p> ")   %>
  </td>
                    </tr>
                    <tr>
                        <td   height= "98 "> <div   align= "center ">
                                <br>
                                <input   name= "myclose "   type= "button "   class= "Style_button_del "
  id= "myclose "   value= "关闭窗口 "   onClick= "javascrip:window.close() ">
                        </div> </td>
                    </tr>
            </table>
        </form> </td>
    </tr>
</table>
  <%
  Response.End    
  end   if    
  Response.AddHeader   "Content-Disposition ",   "attachment;   filename= "   &   myfile.name    
  Response.AddHeader   "Content-Length ",   intFilelength    
  Response.CharSet   =   "UTF-8 "    


  Response.ContentType   =   "application/octet-stream "    
  Response.BinaryWrite   Objstream.Read         '向HTTP输出写入二进制信息
  Response.Flush     '将缓冲信息发送给浏览器
  Objstream.Close    
  Set   Objstream   =   Nothing    
  End   Function    
  %>  
</body>
</html>

[解决办法]
html文本和二进制数据不能同时想浏览器输出的.
二进制数据输出要单独作成asp文件,并且不能包含任何html代码。
[解决办法]
因为脚本里的ado stream可以写任何文件。

热点排行