欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

asp.net實(shí)現(xiàn)服務(wù)器文件下載到本地的方法

 更新時(shí)間:2017年02月06日 14:09:45   作者:冷戰(zhàn)  
這篇文章主要介紹了asp.net實(shí)現(xiàn)服務(wù)器文件下載到本地的方法,需要的朋友可以參考下

1、說明

  通過文件下載框?qū)崿F(xiàn)將服務(wù)器上的文件下載到本地指定位置。這里需要指定服務(wù)器文件路徑

//服務(wù)器文件路徑
string strFilePath = Server.MapPath("~") + "/excel/20170206104654.xlsx";
FileInfo fileInfo = new FileInfo(strFilePath);
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=" + Server.UrlEncode(fileInfo.Name.ToString()));
Response.AddHeader("content-length", fileInfo.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.ContentEncoding = System.Text.Encoding.Default;
Response.WriteFile(strFilePath);

以上所述是小編給大家介紹的asp.net實(shí)現(xiàn)服務(wù)器文件下載到本地的方法,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論