public void Download()
{
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename= 商品管理导入模板.xls");
string FileName = Server.MapPath("..//..//Areas//LR_LGManager//Views//Product//商品管理导入模板.xlsx");
Response.TransmitFile(FileName); //Response.ContentType = "application/x-zip-compressed";
//Response.AddHeader("Content-Disposition", "attachment;filename=商品管理导入模板.xlsx");
//string filename = Server.MapPath("..//..//Areas//LR_LGManager//Views//Product//商品管理导入模板.xlsx");
//Response.TransmitFile(filename);
}
{
Response.ContentType = "application/x-zip-compressed";
Response.AddHeader("Content-Disposition", "attachment;filename= 商品管理导入模板.xls");
string FileName = Server.MapPath("..//..//Areas//LR_LGManager//Views//Product//商品管理导入模板.xlsx");
Response.TransmitFile(FileName); //Response.ContentType = "application/x-zip-compressed";
//Response.AddHeader("Content-Disposition", "attachment;filename=商品管理导入模板.xlsx");
//string filename = Server.MapPath("..//..//Areas//LR_LGManager//Views//Product//商品管理导入模板.xlsx");
//Response.TransmitFile(filename);
}
解决方案 »
- 鈥?ST_StuManager鈥濆簲鐢ㄧ▼搴忎腑鐨勬湇鍔″櫒閿欒銆?hr width=100% size=1 color=silver>
- 请问这两种数据库查询语句的写法区别?
- 新手提问:ASP.NET 2.0中,VS2005开发,使用VB。有很多页面需要调用同一个函数,我想把这些函数集中到一起做成一个单独的东西,其他的页面调用就可以了。请问怎么做?
- 如何让IE的“刷新”按钮失效
- 如何把aaaa"vvvv"nnnnnn字符串中的"vvvv"替换掉?(s.replace('vvvv',"")不行,不知怎么处理双引号
- VS.Net做出来的网页是否要经过一个发布程序才可以在别的服务器正常运行?
- 关于不同服务器文件上传的问题
- C#如何过滤页面中引用的js文件
- 请问在html页面中如何可以插入一个asp.net的文件
- 在webform中如何用程序添加treeview的节点
- /无法从“System.Data.Linq.ISingleResult<Sample21_1.Models.Pr_RegisterResult>”转换为“int
- 随机从数据库查询,传值问题
System.IO.FileStream FS = new FileStream(Server.MapPath("~/Web/ExcelTemplate/test.xlsx"), FileMode.Open, FileAccess.Read);
BinaryReader BR = new BinaryReader(FS);
System.Web.HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlPathEncode("test.xlsx"));
System.Web.HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("big5");
//System.Web.HttpContext.Current.Response.Charset = "big5";
//System.Web.HttpContext.Current.Response.Charset = "utf-8";
//System.Web.HttpContext.Current.Response.Charset = "iso-8859-2";
System.Web.HttpContext.Current.Response.ContentType = "application/octet-stream";
//System.Web.HttpContext.Current.Response.ContentType ="application/vnd.ms-excel";
System.Web.HttpContext.Current.Response.BinaryWrite(BR.ReadBytes(Convert.ToInt32(FS.Length)));
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.Close();
System.Web.HttpContext.Current.Response.End();
我用的url地址才可以