本帖最后由 duanyubao 于 2013-07-01 23:15:14 编辑

解决方案 »

  1.   

    这个有http协议造成的,你用ftp协议让用户下载保存吧。
      

  2.   

    试下这个,我这可以18个以上的汉字
    <%@ WebHandler Language="C#" Class="FileHandler" %>using System;
    using System.Web;using System.Data;
    using System.IO;
    using System.Text;public class FileHandler : IHttpHandler {
        
        public void ProcessRequest (HttpContext context) {        context.Response.ContentType = "text/html";        string maskId = string.Empty;
            if (context.Request.QueryString["ID"] != null)
            {
                maskId = context.Request.QueryString["ID"].ToString().Trim();
                DataTable myDataTable = DBsql.GetDataTable("select * from T_Soft where id =" + maskId);
                if (myDataTable.Rows.Count == 1)
                {
                    string filePath = HttpContext.Current.Server.MapPath("~/" + myDataTable.Rows[0]["DownUrl1"].ToString());
                    if (System.IO.File.Exists(filePath))
                    {
                        FileInfo fileInfo = new FileInfo(filePath);
                        context.Response.Clear();
                        context.Response.ClearContent();
                        context.Response.ClearHeaders();
                        context.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(fileInfo.Name));
                        context.Response.AddHeader("Content-Length", fileInfo.Length.ToString());
                        context.Response.AddHeader("Content-Transfer-Encoding", "binary");
                        context.Response.ContentType = "application/octet-stream";
                        context.Response.ContentEncoding = Encoding.GetEncoding("utf-8");
                        context.Response.WriteFile(fileInfo.FullName);
                        context.Response.Flush();
                        context.Response.End();
                    }
                    else
                    {
                        context.Response.Clear();
                        context.Response.ClearContent();
                        context.Response.ClearHeaders();
                        context.Response.ContentType = "text/html";
                        context.Response.Write("The file does not exist!");
                        context.Response.Flush();
                        context.Response.End();
                    }
                }
                else
                {
                    context.Response.Clear();
                    context.Response.ClearContent();
                    context.Response.ClearHeaders();
                    context.Response.ContentType = "text/html";
                    context.Response.Write("The resource does not exist!");
                    context.Response.Flush();
                    context.Response.End();
                }
            }
        }
     
        public bool IsReusable {
            get {
                return false;
            }
        }}
      

  3.   

    try this:
    http://www.cnblogs.com/insus/articles/2003336.html
      

  4.   

    @lonelypig1   
    网上的效果一个都没有实现~~楼主想过为什么这些代码不行吗?自己可以改动改动吗?我是新手,你有什么好的建议吗?
      

  5.   

    你为什么不试试我说的ftp协议下载呢?
      

  6.   

    你为什么不试试我说的ftp协议下载呢?请教高手,怎么使用FTP协议下载,有没有源代码参考一下?
      

  7.   

    你为什么不试试我说的ftp协议下载呢?请教高手,怎么使用FTP协议下载,有没有源代码参考一下?
    不需要源代码,你建立一个FTP服务器,用serv-u之类的软件,
    软件中配置服务器上提供下载的文件目录。
    你原本是http://www.abc.com/aa.txt
    就改成  ftp://www.abc.com/aa.txt   即可
      

  8.   

    注意 这类下载需要设置ftp为可匿名访问,你设置成只读就可以了,并且设置不允许list请求。