By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,458 Members | 1,003 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,458 IT Pros & Developers. It's quick & easy.

Error downloading file with Firefox

P: n/a
Hi there!

I'm trying to download a file in my asp.net web, but when downloading it
from a Firefox browser, instead of downloading the example.exe file, it's
downloading example.exe.htm. My code is the following:

string localfile = MyComponent.DownloadMyExe(index);
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType="application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" +
Regex.Replace(localfile, @"\\\\(\w)*\\(\w)*\\(\w)*\\(?<Name>)*", "${Name}"));
Response.WriteFile(localfile);
Response.End();

With IE runs fine. Which is the problem, anyone knows?

Thanks a lot!

Jan 16 '06 #1
Share this Question
Share on Google+
2 Replies

P: n/a
"Tomas Martinez" <To***********@discussions.microsoft.com> wrote in message
news:5B**********************************@microsof t.com...
Hi there!

I'm trying to download a file in my asp.net web, but when downloading it
from a Firefox browser, instead of downloading the example.exe file, it's
downloading example.exe.htm. My code is the following:


Just a guess here.... maybe Firefox is padding the filename with htm because
exe is not a registered MIME file type. I've run into this type of thing
before (in VB6) and what I had to do was give the file on the server a "txt"
or "zip" extension... once downloaded locally, I had to rename it to it's
correct extension.

MIME Types and File Extensions
http://www.cesis.lv/learn/CGIperl/ch15.htm

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
Jan 16 '06 #2

P: n/a
Hi Ken,

First, thanks for your answer, very interesting to know for future problems.
The real one was on my code. My first lines in a previous dll were these:

Response.ClearContent();
Response.ContentType="application/octet-stream";
Response.ClearHeaders();

So it couldn't know that the passed file were an exe although the extension,
sure. On the other side IE could recognize my file as an .exe, so I didn't
discovered this error until I didn't open my web on a Firefox browser. And,
finally, although I uploaded the good dll to the server, this was using the
older in the asp temp folder, so here was my problem. Thanks in anycase for
your answer, it's interesting and it's cool to know that people helps you
"por amor al arte", as we say here in Spain :)

Regads!

"Ken Halter" wrote:
"Tomas Martinez" <To***********@discussions.microsoft.com> wrote in message
news:5B**********************************@microsof t.com...
Hi there!

I'm trying to download a file in my asp.net web, but when downloading it
from a Firefox browser, instead of downloading the example.exe file, it's
downloading example.exe.htm. My code is the following:


Just a guess here.... maybe Firefox is padding the filename with htm because
exe is not a registered MIME file type. I've run into this type of thing
before (in VB6) and what I had to do was give the file on the server a "txt"
or "zip" extension... once downloaded locally, I had to rename it to it's
correct extension.

MIME Types and File Extensions
http://www.cesis.lv/learn/CGIperl/ch15.htm

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..

Jan 18 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.