ASP.NETファイルのダウンロード

要約:ASP.NETファイルのダウンロード


 if (string.IsNullOrEmpty(Request["token"]))
            {
                Response.Write("密码错误");
                return;
            }

            Response.Clear();
            Response.AddHeader("content-disposition", "attachment;filename=" + Server.UrlEncode("DonmaSampleExcelFile" + DateTime.Now.ToString("yyyyMMddHHmm") + ".xls"));

            //设定MIME 标头
            //可以参考 http://baike.baidu.com/view/160611.htm
            Response.ContentType = "application/octet-stream";
            Response.BinaryWrite(File.ReadAllBytes(AppDomain.CurrentDomain.BaseDirectory + "\ABC\npoi2.xls"));

オリジナル:ビッグボックス  ASP.NETファイルのダウンロード


おすすめ

転載: www.cnblogs.com/chinatrump/p/11458259.html