http文件导出

using (MemoryStream file = db.ExportExcel(model))
       {
                context.Response.ContentType = "application/vnd.ms-excel";
                context.Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", "历史告警数据.xls"));
                context.Response.Clear();
                file.WriteTo(context.Response.OutputStream);
                context.Response.End();
        }

 

posted @ 2016-08-01 14:52  小小高  阅读(349)  评论(0)    收藏  举报