我前端使用的vue 使用ajax调用webapi来做npoi的导出功能 导出成功之后想输出到页面 在页面下载下来 可是在生成excel后面调用以下代码完全没动静 从网上找各种解决办法 可是都没用 哪位大佬来给个建议呢 最好附上一段代码
void downloadfile(string filePath)
{
System.IO.FileInfo file = new System.IO.FileInfo(filePath);
HttpContext.Current.Response.ContentType = "application/ms-download";
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Type", "application/octet-stream");
HttpContext.Current.Response.Charset = "utf-8";
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(file.Name, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Content-Length", file.Length.ToString());
HttpContext.Current.Response.WriteFile(file.FullName);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.End();
}