Asp.net mvc MVC文件下载在IE中不起作用

Asp.net mvc MVC文件下载在IE中不起作用,asp.net-mvc,internet-explorer,Asp.net Mvc,Internet Explorer,我看到过许多关于将文件返回到视图和刷新等的问题和帖子。我的问题是,返回在Firefox、Chrome等中有效,但在IE中不起作用。当在IE中执行相同的代码时,它实际上刷新了视图,但我没有得到任何文件。我在aspx上的脚本中有一个单击处理程序 function RunReport(iExport) { var fromDate = ""; var toDate = ""; fromDate = viewModel.FromDate;

我看到过许多关于将文件返回到视图和刷新等的问题和帖子。我的问题是,返回在Firefox、Chrome等中有效,但在IE中不起作用。当在IE中执行相同的代码时,它实际上刷新了视图,但我没有得到任何文件。我在aspx上的脚本中有一个单击处理程序

    function RunReport(iExport) {
        var fromDate = "";
        var toDate = "";

        fromDate = viewModel.FromDate;
        toDate = viewModel.ToDate;

        $.ajax({
            url: 'Reports/RunReport',
            type: 'POST',
            dataType: "json",
            traditional: true,
            data: { 'fromdate': fromDate, 'toDate': toDate, 'doExport': iExport },
            success: function (data) {
                if (data.success == "true") {
                    location.reload();         
                }
            },
            error: function (e) {
                //notify.show({type: 'error', header: "Error applying Filters!", content: "Unable to apply filters." + e });
            }
        });  
    }
RunReport
操作设置一些变量,返回真实结果,然后页面重新加载检查
iExport
变量

在加载页面(
ActionResult Index()
)的过程中,使用一些已设置的过滤器和变量刷新数据。然后,如果
iExport=1
它会:
返回ExportReport(model)

出口报告:

    public FileContentResult ExportReport(ReportViewModel model)
    {
        string sCSV = "";
        sCSV = DoSomeProcessingToGetCSVString...;
//我试过这个,有没有头球

        var cd = new System.Net.Mime.ContentDisposition
        {
            // for example foo.bak
            FileName = "Test.csv",

            Inline = false,
        };

        Response.AppendHeader("Content-Disposition", cd.ToString());
        return File(new System.Text.UTF8Encoding().GetBytes(sCSV), "text/csv", "Test.csv");
}

当它返回文件时,实际上只是再次刷新/重新加载调用Index()操作结果的页面,并且它永远不会生成下载。这在其他浏览器中不起作用,并且不会刷新页面

当最初接收到iExport=1时,我将其重置为null,这样返回页面将不会继续导出。如果我把它注释掉,并让它保持=1,那么第二次加载时,它会导出文件,但当然会导航到空白页

是否有更好的方法来实现这一点,或者IE是否存在问题(我使用IE11)