public ActionResult DownloadMessage() { string strExportData = "无数据!"; byte[] data = System.Text.Encoding.GetEncoding("GB2312").GetBytes(strExportData); return File ( data, "application/x-msexcel", string.Format("ErrorInfo_{0}.csv", DateTime.Now.ToString("yyyyMMddHHmmss")) ); }
Today we learned a trick.
Reproduced in: https: //www.cnblogs.com/ushou/p/3419588.html