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 に答える