locked
Error Management in file download RRS feed

  • Question

  • User1973628327 posted

    Hi,

    I have a button with excel file download:

    onclick="window.open('@Url.Action("DownloadReport", "MyController")', '')"

    I need to show a message if an error occurs while generating files. I tried to use a function

    function downloadReport(){
                $.post("@Url.Action("DownloadReport", "MyController")", function (file) {
                    window.location.href=file;
                });
            }

    From Controller

    return base.File(myFile, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName);

    But download doesn't starts because I lose attachments attribute from the response.

    How can I do that?

    Thursday, February 28, 2019 4:00 PM

All replies