“你想打开还是保存”不显示

时间:2012-10-22 13:05:19

标签: c# excel razor asp.net-mvc-4

我的代码:

    [AcceptVerbs(HttpVerbs.Get)]
    public ActionResult Export()
    {
        DataTable table = ListToDataTable();

        var rows = table.AsEnumerable().AsQueryable() as IEnumerable<DataRow>;
        var output = CreateXlsStream(rows);
        return File(output, "application/vnd.ms-excel", "Export.xls");
    }

“你想打开还是保存”不显示。我想在执行“return File(output,”application / vnd.ms-excel“,”Export.xls“)后默认显示”你想打开还是保存“;' line.Thanks。

1 个答案:

答案 0 :(得分:0)

这应该有效:

Response.AppendHeader("Content-Disposition", "inline; filename=Export.xls");
return File(...