0

我需要运行下载然后继续执行代码吗?我该怎么办?

此功能正在检查文件何时被下载到我的服务器上,然后我需要运行下载到我的客户端计算机,女巫是我尝试 window.open("url") 的地方。

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();
}
4

1 回答 1

0

如果您想跟踪下载状态,您必须选中此项。你可以根据这篇文章有一些想法。

http://www.codeproject.com/Articles/74654/File-Download-in-ASP-NET-and-Tracking-the-Status-o

于 2012-10-23T12:46:27.693 回答