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

谁给个ASP下载的代码

RT --------------------编程问答-------------------- --------------------编程问答-------------------- http://www.51aspx.com/ --------------------编程问答-------------------- 慢了
中国站长 也有 --------------------编程问答--------------------  private void DownLoadFile(string fileName)
    {  
        string filePath = Server.MapPath(".") + "\\" + fileName;
        if (File.Exists(filePath))
        {
            FileInfo file = new FileInfo(filePath);
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); //解决中文乱码
            Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(file.Name)); //解决中文文件名乱码    
            Response.AddHeader("Content-length", file.Length.ToString());
            Response.ContentType = "appliction/octet-stream";
            Response.WriteFile(file.FullName);
            Response.End();
        }
    } 



你试试`~~~~~~
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,