我需要运行下载然后继续执行代码?我该怎么做?
此功能正在检查何时将文件下载到我的SEVER上时,然后我需要下载到我的客户端计算机,Witch是我尝试window的地方。
function checkSpreadsheetProgress(taskId, filename) {
var intervalId2 = setInterval(function () {
$.post("SpreadSheetProgress", { id: taskId }, function (SpreadSheetProgress) {
if (SpreadSheetProgress >= 100) {
clearInterval(intervalId2);
window.open("http://formvalue.co.za/download/" + filename + ".xlsx")
//The line above is my attempt at running the download link but it did nothing?
//The line below pushes me to my Downloadcompleate action result.
window.location.href = "downloadcomplete?filename=" + filename;
} else {
}
});
}, 100);
}
我可以下载带有C#的文件,但不能继续使用重定向方法后面的代码。
public ActionResult DownloadComplete(string filename)
{
//return Redirect("http://formvalue.co.za/download/" + filename + ".xlsx");
// The above line will download the file but then i cant return a view?
return View();
}
如果要跟踪下载状态,则必须检查一下。您可以根据本文有一些想法。
http://www.codeproject.com/articles/74654/file-download-inload-in-asp-net-and-tracking-the-status-o