当前位置:编程学习 > C#/ASP.NET >>

各位大虾帮我看下出什么错了啊

 private void downLoadFile(string path, string name)
    {
        //Response.Write(Utils.GetMapPath(path + name));
        try
        {

            System.IO.FileInfo file = new System.IO.FileInfo(Utils.GetMapPath(path + name));
            Response.Clear();
            Response.Charset = "GB2312";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            //添加头信息,为 "文件下载/另存为 "对话框指定默认文件名 
            Response.AddHeader("Content-Disposition ", "attachment;filename= " + Server.UrlEncode(name));
            //添加头信息,指定文件大小,让浏览器能够显示下载进度 
            Response.AddHeader("Content-Length ", file.Length.ToString());
            Response.ContentType = "application/octet-stream ";
            //把文件流发送到客户端 
            Response.WriteFile(file.FullName);
            //停止页面的执行 
            Response.End();
        }
        catch //(System.Threading.ThreadAbortException ex)
        {
            throw;//Response.Write(ex.Message);
        }
帮我看下这个下载出什么问题了啊 --------------------编程问答--------------------   System.IO.FileInfo   file   =   new   System.IO.FileInfo(Utils.GetMapPath(path   +   name)); 
path应该是相对路径???输出一下path的值 --------------------编程问答-------------------- path+name是个绝对路径
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,