C#mvc怎么从服务器上下载文件到客户端 是这样的,我用extjs做了个考勤系统,因功能需要,我就做了个导出excel能。当发布到iis上,直接导到iis那台服务器上了,请问怎么把他下载到访问的客户端上?没钱了,高手解答些吧,谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 啥意思呢,你生成xls文件,然后将文件的连接输出到或者直接返给客户 做一个excel模板啥,当点击到处的时候,把需要到处的数据写入excel,下载到本地就是啥,网上这类例子很多的 用response输出啊。 这是我导出优惠券用的代码。。 StringWriter sw = new StringWriter(); sw.WriteLine("优惠券批次号\t优惠券号码\t优惠券金额\t过期时间"); foreach (CouponItemInfo itemInfo in result) { string line = lotNumber + "\t" + itemInfo.ClaimCode + "\t" + coupon.DiscountValue + "\t" + coupon.ClosingTime; sw.WriteLine(line); } sw.Close(); Page.Response.AddHeader("Content-Disposition", "attachment; filename=" + "CouponsInfo_" + DateTime.Now + ".xls"); Page.Response.ContentType = "application/ms-excel"; Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); Page.Response.Write(sw); Page.Response.End(); C#无法还原正在使用的数据库 Panel.DrawToBitmap()好慢啊! c#数据库获取问题 一个c#问题,求高手帮我解决一下 求这个控件取值错误 c#快速入门应该看什么? 出现在建立与服务器的连接时出错 事件问题,谢谢各位帮忙 求抓取这个页面的代码 关于listbox小控件的一个细节问题! 求助:Winform中左上角图标的菜单项怎么删除? 求助,超大图片编辑问题,tif格式
sw.WriteLine("优惠券批次号\t优惠券号码\t优惠券金额\t过期时间"); foreach (CouponItemInfo itemInfo in result)
{
string line = lotNumber + "\t" + itemInfo.ClaimCode + "\t" + coupon.DiscountValue + "\t" + coupon.ClosingTime;
sw.WriteLine(line);
}
sw.Close();
Page.Response.AddHeader("Content-Disposition", "attachment; filename=" + "CouponsInfo_" + DateTime.Now + ".xls");
Page.Response.ContentType = "application/ms-excel";
Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
Page.Response.Write(sw);
Page.Response.End();