三种方式:
返回url地址 前台以window.open打开该地址
public ActionResult GetUrl(){
//拼接一个地址 返回给前台
return Json(new { data = "https://qwert.com/export/" + Path.GetFileName(ExportFileName) });
}
前端:
window.open(url);
以文件流形式返回,但是会出现文件占用无法下载情况
public ActionResult GetUrl(){
string path="D:\\123.apk";
return File(
new FileStream(path, FileMode.Open),
"application/octet-stream",
"123.apk"
);
}
重定向方式
public ActionResult GetUrl(){
string path = $"http://qwert.com/123.apk";
return Redirect(path);
}