Unable to download files from application in Mozilla firefox

Posted on 2009-07-11
Medium Priority
Last Modified: 2013-12-07
We have a link in one of our web pages. On click of this link we open a pop-up window in which we display all documents that a user has uploaded to our application. We are opening the pop-up window as a model dialog using the function 'window.showModalDialog()' in javascript.

We have a download link for each attachment uploaded. The download link triggers a post-back event which downloads a file from the server. During the download, the 'save-as' dialog box opens.

Now the problem is, during the execution of above scenario in Mozilla Firefox browser, once the 'save as' dialog box opens (as shown in the attachment), the whole dialog box freezes. The 'save-as' or 'Cancel' buttons does not work. The 'save as' dialog box can be closed only using the window close (X) button. As a result, we are not able to download the file which we intend to. This problem does not occur with the Internet Explorer browser and so we are able to download the file. We are facing this problem only with Mozilla Firefox.

This 'save as' dialog box also works perfectly if the window with all attachments is opened as an ordinary window (using the function 'window.open()') instead of the modal dialog.

I have attached code and word document with code.

if (!IsPostBack)
                if (Request.QueryString.ToString() == "instructions")
                    pnlInstructions.Visible = true;
                    root = System.Configuration.ConfigurationSettings.AppSettings["attachement_root"].ToString();
                    filepath = Session["filepath"].ToString();
                    filename = Session["filename"].ToString();
                    string[] s_arr = filepath.Split(new char[] { '\\' });
                    filename = s_arr[s_arr.Length - 1];//filepath.Substring(filepath.LastIndexOf("\\"), filepath.Length-filepath.LastIndexOf("\\"));
                    if (filepath != null)
                        if (File.Exists(filepath))
                            Response.Buffer = true;
                            FileInfo DownloadFileInfo = new FileInfo(filepath);
                            string Ext = DownloadFileInfo.Extension;
                            if (Ext != null)
                                Ext = Ext.ToLower();
                            switch (Ext)
                                case ".exe":
                                    //Exe file
                                    Response.ContentType = "application/octet-stream";
                                case ".zip":
                                    //Zip file
                                    Response.ContentType = "application/x-zip-compressed";
                                case ".pdf":
                                    //Pdf file
                                    Response.ContentType = "application/pdf";
                                case ".doc":
                                    //MS Word
                                    Response.ContentType = "Application/msword";
                                case ".docx":
                                    //MS Word
                                    Response.ContentType = "Application/msword";
                                case ".dll":
                                    //Dll file
                                    Response.ContentType = "application/x-msdownload";
                                case ".html":
                                    //Html file
                                    Response.ContentType = "text/HTML";
                                case ".txt":
                                    //Txt file
                                    Response.ContentType = "text/plain";
                                    //Response.ContentType = "application/notepad";
                                case ".jpeg":
                                    //Jpg picture
                                    Response.ContentType = "image/JPEG";
                                case ".jpg":
                                    //Jpg picture
                                    Response.ContentType = "image/jpg";
                                case ".bmp":
                                    //bmp picture
                                    Response.ContentType = "image/bmp";
                                    Response.ContentType = "application/octet-stream";
                            Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);
                            Response.TransmitFile(filepath );

Open in new window

Question by:mauneeld
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

mauneeld earned 0 total points
ID: 24855334
(Modal Window) FileUploadNew à opens File DownloadNew.       This was not working.

So what I did was, created a temporary file which will open as a new simple window and that new window will now call FileDownloadNew.

(Modal Window) FileUploadNew à opens FileDownloadTemp (simplewindow) à opens FileDownloadNew. this works fine.


Expert Comment

ID: 32632991
The solution is not clear.
What is FileUploadNew & DownloadNew. It seems they are some functions in your code, which are not mentioned in the files you have attached.

Could you please explain it in more detail?

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I had to do a bit of research to find the answer to this question so I thought I'd share my results.  Due to our outdated mainframe systems, we need to downgrade IE9 to IE8 in order to stay compatible.  We also needed to downgrade Java.  In order to…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question