那是IE的功能吧,如.exe|.zip之类的文件,它自然会出现下载提示窗口。

解决方案 »

  1.   

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    </head><body>
    <%    
    'filename="/dxsck/文字测试/全新版大学英语综合教程1/test1.da"
    filename="/dxsck/aa.lg"
    'filename="/dxsck/听读资料/全新版大学英语综合教程1/第一册/unit1/1.wlg"
    call  downloadFile(filename)    
    Function  downloadFile(strFile)    
    '  make  sure  you  are  on  the  latest  MDAC  version  for  this  to  work    
    '  -------------------------------------------------------------    
    '  get  full  path  of  specified  file    
    strFilename  =  server.MapPath(strFile)    
    '  clear  the  buffer    
    Response.Buffer  =  True    
    Response.Clear    
    '  create  stream    
    Set  s  =  Server.CreateObject("ADODB.Stream")    
    s.Open    
    '  Set  as  binary    
    s.Type  =  1    
    '  load  in  the  file    
    on  error  resume  next    
    '  check  the  file  exists    
    Set  fso  =  Server.CreateObject("Scripting.FileSystemObject")    
    if  not  fso.FileExists(strFilename)  then    
    Response.Write("<h1>Error:</h1>"  &  strFilename  &  "  文件不存在<p>")    
    Response.End    
    end  if    
    '  get  length  of  file    
    Set  f  =  fso.GetFile(strFilename)    
    intFilelength  =  f.size    
    s.LoadFromFile(strFilename)    
    if  err  then    
    Response.Write("<h1>Error:</h1>文件下载错误<p>")    
    Response.End    
    end  if    
    '  send  the  headers  to  the  users  browser    
    Response.AddHeader  "Content-Disposition",  "attachment;  filename="  &  f.name    
    Response.AddHeader  "Content-Length",  intFilelength    
    Response.CharSet  =  "gb2312"    
    Response.ContentType  =  "application/octet-stream"    
     
    '  output  the  file  to  the  browser    
    Response.BinaryWrite  s.Read    
    Response.Flush    
     
    '  tidy  up    
    s.Close    
    Set  s  =  Nothing    
     
    End  Function    
    %>      
    </body>
    </html>
      

  2.   

    York_Jiang() ,如果要下载的文件后缀是.html或.gif之类的,可以行得通吗?