日期:2014-05-17  浏览次数:20404 次

response 下载文件
response 下载文件时。用局域网IP访问时可以下载大文件。用外网访问时下载10M以上的大文件时,不到1秒就结束下载,文件都只有2.91K的大小。那位高手知道为什么

------解决方案--------------------
试试这个

public void DownLoad(string path,string filename)
    {
        if (System.IO.File.Exists(path))
        {
            FileInfo file = new FileInfo(path);
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); //解决中文乱码
            Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(filename)); //解决中文文件名乱码    
            Response.AddHeader("Content-length", file.Length.ToString());
            Response.ContentType = "appliction/octet-stream";
            Response.WriteFile(file.FullName);
            Response.End();
        }
    }

------解决方案--------------------
"文件都只有2.91K的大小"里面是错误信息吧
------解决方案--------------------
是不是浏览器没有关闭那个什么什么筛选- -