I am using jquery Ajax for downloading PDF file, I generate PDF on runtime and download it, This is my Ajax call
  $.ajax({
            async: "false",
            type: "POST",
            url: "/Reports/DownloadFile?userId=" + encodeURIComponent(userId) + "&date=" + encodeURIComponent(date),
            success: function (result) {
            }
        });
and this is what I am doing in ActionResult
 public FileContentResult DownloadFile(int userId, string date, int rptType)
        {
            var userInfo = UserBLL.GetUserByID(associateId).Name;
            var dtFileDate = Convert.ToDateTime(date);
            var pdfStream = GeneratePDFStream(userId, date);//Generating Stream
if(date < DateTime.Now)
{       
return File(pdfStream, "application/pdf", string.Format("MyReport{0}{1}.pdf", userInfo.Name, dtFileDate.ToShortDateString().Replace("/", "")));
}
return null; 
        }
but its returning
Sorry, an error occurred while processing your request.
How can I download the file with Ajax call? Please note that I can't use jquery FileDownload but I can do without Ajax call, Kindly suggest I also tried with this,but same error
 var url = "/Reports/DownloadFile?userId=" + encodeURIComponent(userId) + "&date=" + encodeURIComponent(date);
        window.open(url);
 
    