Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting error while download file in Firefox
    text
    copied!<p>I am facing a problem in my application. I have some section in application from where user can download data in excel file.Code is working absolutely fine in local, Means file is getting download properly in local with every browser. But when we download file from test or live server its shows a popup with following error</p> <blockquote> <p>"C:\Users\PHT~1.AMI\AppData\Local\Temp\hXybMbIw.xlsx.part could not be saved, because the source file could not be read. Try again later, or contact the server administrator." </p> </blockquote> <p>in case of firefox browser only.</p> <p>I am using following code for file download</p> <pre><code> function ExportToExcel(isJdl) { var url = '/Product/ExportToExcel?isJdl=' + isJdl + "&amp;projID=" + _projID + "&amp;PlanPages=" + escape($("#PlanPages").val()) + "&amp;SpecSections=" + escape($("#SpecSections").val()) + "&amp;Addenda=" + escape($("#Addenda").val()) + "&amp;HighLite=" + $("#chkHighLite").attr("checked"); Download(url); } function Download(url) { var win = window.open(url, "DownloadWin", "resizable=0,status=0,toolbar=0,width=600px,height=300px"); win.focus(); win.moveTo(100, 100); } </code></pre> <p>Controller Code is as follow:-</p> <pre><code>public void ExportToExcel(bool isJdl, string projID, string planPages, string specSections, string addenda, string HighLite) { int pID = int.Parse(projID.Decrypt()); bool HightLiteVal = false; if (!string.IsNullOrEmpty(HighLite)) HightLiteVal = Convert.ToBoolean(HighLite); Highmark.BLL.Models.Project proj = Highmark.BLL.Services.ProjectService.GetByID(pID); if (proj != null) { proj.PlanPages = planPages; proj.SpecSections = specSections; proj.Addenda = addenda; proj.HighLite = HightLiteVal; using (OfficeOpenXml.ExcelPackage pck = new OfficeOpenXml.ExcelPackage()) { OfficeOpenXml.ExcelPackage pck1 = Highmark.BLL.Services.ProjectService.GetExcelFile(isJdl, pck, pID, proj, planPages, specSections, addenda); string name = string.Format("{0}", proj.ProjectName); if (pck1.Workbook.Worksheets.Count &gt; 0) { //Write it back to the client Response.ContentType = "Application/vnd.ms-Excel"; //Remove Invalid Character from File Name name = name.RemoveInvalidCharFromFileName(); Response.AddHeader("content-disposition", "attachment; filename=\"" + name + "_HighEST.xlsx\""); Response.BinaryWrite(pck1.GetAsByteArray()); } } } else Response.Write("Error: Invalid request, please try again"); } </code></pre> <p>Any help is appreciated. Thanks </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload