简体   繁体   中英

“Do you want to Open or save” not displaying

My Code:

    [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");
    }

"Do you want to Open or save" not displaying. I want to display "Do you want to Open or save" by default after executing this "return File(output, "application/vnd.ms-excel", "Export.xls");' line.Thanks.

this should work:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM