Downloading a file - and why it sometimes doesn't work
-
Hi, I've been involved in a web application that allows the user to download files stored in a database. Those files were added to the database through various sources: from scanner, from folders, and through my application which is a plugin into Office, so the users can save Office files directly from Outlook/Excel/Word. Getting an Office plugin to work correctly with various versions of Office is not for the faint hearted, I might even write an article about that one day. But that's not what this message is about. We were having problems with certain files on certain computers at the client site: when they were downloaded - and the user selected to open the file instead of saving it to disk first - the application responsible for opening the file wasn't able to, and claimed that the file could not be found. And this only happened if the user was using IE, this was not a problem with Firefox. It seemed to mostly apply to .msg files, but there were reports that it also happened to other file types. When we finally found a development machine where we could reproduce the problem, I began by using Filemon[^] to monitor what happened when I tried downloading an .msg file, and if the file was indeed created or what was happening. It turned out that Internet Explorer DID download the file, AND it did request that this file should be opened by the correct application (Outlook.exe), but just before the application would try to open the file, IE would simply delete the file! No wonder the application was having trouble with opening it. Then I tried using Regmon[^] to figure out if there was some security setting that was being read that controlled this behaviour, but I didn't find anything useful there. I also found out that this wasn't a problem with other websites: I could download files from other websites I had access to (entirely different websites, written by other programmers using other languages), so that meant that the problem had to be with our code on the webserver. I remembered having seen a blog post about some HTTP traffic monitor tool on the IE website, so I downloaded Fiddler[
-
Hi, I've been involved in a web application that allows the user to download files stored in a database. Those files were added to the database through various sources: from scanner, from folders, and through my application which is a plugin into Office, so the users can save Office files directly from Outlook/Excel/Word. Getting an Office plugin to work correctly with various versions of Office is not for the faint hearted, I might even write an article about that one day. But that's not what this message is about. We were having problems with certain files on certain computers at the client site: when they were downloaded - and the user selected to open the file instead of saving it to disk first - the application responsible for opening the file wasn't able to, and claimed that the file could not be found. And this only happened if the user was using IE, this was not a problem with Firefox. It seemed to mostly apply to .msg files, but there were reports that it also happened to other file types. When we finally found a development machine where we could reproduce the problem, I began by using Filemon[^] to monitor what happened when I tried downloading an .msg file, and if the file was indeed created or what was happening. It turned out that Internet Explorer DID download the file, AND it did request that this file should be opened by the correct application (Outlook.exe), but just before the application would try to open the file, IE would simply delete the file! No wonder the application was having trouble with opening it. Then I tried using Regmon[^] to figure out if there was some security setting that was being read that controlled this behaviour, but I didn't find anything useful there. I also found out that this wasn't a problem with other websites: I could download files from other websites I had access to (entirely different websites, written by other programmers using other languages), so that meant that the problem had to be with our code on the webserver. I remembered having seen a blog post about some HTTP traffic monitor tool on the IE website, so I downloaded Fiddler[
dabs wrote:
believe that this would qualify as a subtle bug
Same here. I'll keep note of this in case I run into it, too.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
-
Hi, I've been involved in a web application that allows the user to download files stored in a database. Those files were added to the database through various sources: from scanner, from folders, and through my application which is a plugin into Office, so the users can save Office files directly from Outlook/Excel/Word. Getting an Office plugin to work correctly with various versions of Office is not for the faint hearted, I might even write an article about that one day. But that's not what this message is about. We were having problems with certain files on certain computers at the client site: when they were downloaded - and the user selected to open the file instead of saving it to disk first - the application responsible for opening the file wasn't able to, and claimed that the file could not be found. And this only happened if the user was using IE, this was not a problem with Firefox. It seemed to mostly apply to .msg files, but there were reports that it also happened to other file types. When we finally found a development machine where we could reproduce the problem, I began by using Filemon[^] to monitor what happened when I tried downloading an .msg file, and if the file was indeed created or what was happening. It turned out that Internet Explorer DID download the file, AND it did request that this file should be opened by the correct application (Outlook.exe), but just before the application would try to open the file, IE would simply delete the file! No wonder the application was having trouble with opening it. Then I tried using Regmon[^] to figure out if there was some security setting that was being read that controlled this behaviour, but I didn't find anything useful there. I also found out that this wasn't a problem with other websites: I could download files from other websites I had access to (entirely different websites, written by other programmers using other languages), so that meant that the problem had to be with our code on the webserver. I remembered having seen a blog post about some HTTP traffic monitor tool on the IE website, so I downloaded Fiddler[
Almost makes you wonder why IE downloaded the file in the first place. :)
Chris Meech I am Canadian. [heard in a local bar] Donate to help Conquer Cancer[^]
-
Almost makes you wonder why IE downloaded the file in the first place. :)
Chris Meech I am Canadian. [heard in a local bar] Donate to help Conquer Cancer[^]
Exactly :-) This didn't happen all the time though, I'm not sure what configuration of IE causes this problem. Most of our development machines never displayed this behaviour. Regards, Daníel
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
-
Almost makes you wonder why IE downloaded the file in the first place. :)
Chris Meech I am Canadian. [heard in a local bar] Donate to help Conquer Cancer[^]
because you told it so? :D
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist -
Hi, I've been involved in a web application that allows the user to download files stored in a database. Those files were added to the database through various sources: from scanner, from folders, and through my application which is a plugin into Office, so the users can save Office files directly from Outlook/Excel/Word. Getting an Office plugin to work correctly with various versions of Office is not for the faint hearted, I might even write an article about that one day. But that's not what this message is about. We were having problems with certain files on certain computers at the client site: when they were downloaded - and the user selected to open the file instead of saving it to disk first - the application responsible for opening the file wasn't able to, and claimed that the file could not be found. And this only happened if the user was using IE, this was not a problem with Firefox. It seemed to mostly apply to .msg files, but there were reports that it also happened to other file types. When we finally found a development machine where we could reproduce the problem, I began by using Filemon[^] to monitor what happened when I tried downloading an .msg file, and if the file was indeed created or what was happening. It turned out that Internet Explorer DID download the file, AND it did request that this file should be opened by the correct application (Outlook.exe), but just before the application would try to open the file, IE would simply delete the file! No wonder the application was having trouble with opening it. Then I tried using Regmon[^] to figure out if there was some security setting that was being read that controlled this behaviour, but I didn't find anything useful there. I also found out that this wasn't a problem with other websites: I could download files from other websites I had access to (entirely different websites, written by other programmers using other languages), so that meant that the problem had to be with our code on the webserver. I remembered having seen a blog post about some HTTP traffic monitor tool on the IE website, so I downloaded Fiddler[
You could try using the content-disposition header to set the filename. We had some similar problems and this seemed to resolve them. Additionally, are the failing cases on Windows Vista/Ie7? I believe there are security features that prevent some downloaded files types from being opened in certain cases (think it's something to so with the user the isolation tricks IE7 uses).