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);
}
解决方案 »
- 有关未能加载程序集的问题
- 在default.aspx及其他页面怎么套用母版页
- 复制表删除重复问题
- 一个GridView求金额列合计的问题
- 救命!!!!!! 添加Web引用问题
- 计算机显示器超频怎么办?急!急!急!
- 紧急求助!怎样使用C#-Asp.net实现文件上传,怎样修改已有Accesss数据库中的用户登陆密码?
- 如何在ASP.NET中采用droplistdown联动的方式进行登陆?
- 已有打开的与此命令相关联的 DataReader,必须首先将它关闭。
- 急用:怎样把从数据库中读出来的图片赋给某一指定的image控件
- /无法从“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地址才可以