473,675 Members | 3,131 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error downloading file with Firefox

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.Dow nloadMyExe(inde x);
Response.ClearC ontent();
Response.ClearH eaders();
Response.Conten tType="applicat ion/octet-stream";
Response.AddHea der("Content-Disposition", "attachment ; filename=" +
Regex.Replace(l ocalfile, @"\\\\(\w)*\\(\ w)*\\(\w)*\\(?< Name>)*", "${Name}")) ;
Response.WriteF ile(localfile);
Response.End();

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

Thanks a lot!

Jan 16 '06 #1
2 2769
"Tomas Martinez" <To***********@ discussions.mic rosoft.com> wrote in message
news:5B******** *************** ***********@mic rosoft.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
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.ClearC ontent();
Response.Conten tType="applicat ion/octet-stream";
Response.ClearH eaders();

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.mic rosoft.com> wrote in message
news:5B******** *************** ***********@mic rosoft.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4818
by: Steve | last post by:
hello all im looking to make a download script as i cannot use the .htaccess to control directory access to files as im using a php login system using mysql and sessions. i have been playing about with fopen and fpassthru but having a few problems making the file download. The files involved would mainly be but not limited to .pdfs, .docs and .zips
0
4997
by: Rhon Stewart via DotNetMonster.com | last post by:
Hi please visit this link : http://www.eggheadcafe.com/articles/pfc/selfupdater.asp I followed all the steps for listed on the link , when I execute the application it it gives me the following error on the log file: --- ApplicationUpdateManager.StartUpdater] : The Updater has started; the target application's name is 'SayHello'. Time started: 2005_03_01_14:33:21.
0
982
by: Mamatha | last post by:
Hi i have one ASP page,when i click a download button in that page it downloads a file from net,and the file size is nearly 70MB,so while at the time of downloading a file the asp page displayed suddenly,page can not be displayed error but the background process(file downloading) is running.How can i manage that asp page without displaying error,Is there any alternative solution for that?Please give me the solution.
0
2651
by: Marty Cruise | last post by:
I successfully deploy my application to 20 domain users. Only one new user is giving me a problem, although he can access all domain resources. When he clicks the installation link on the publish page, Framework 2.0 installs successfully, but then the application installation fails during the "Verifying Application Requirements" process. Can anyone help me figure out how to solve this? Error is as follows. PLATFORM VERSION INFO...
0
5241
by: Tifer | last post by:
Hello, I am building my first .Net Application. The first couple of Publish and Installs I did went fine. But after a couple of builds, I get a modal dialogue box error every time upon trying to install using the setup.exe. Title is "Cannot Start Application" and it says: ==================== Cannot download the application. The application is missing required files. Contact application vendor for assistance.
7
3667
by: Jetus | last post by:
I am able to download this page (enclosed code), but I then want to download a pdf file that I can view in a regular browser by clicking on the "view" link. I don't know how to automate this next part of my script. It seems like it uses Javascript. The line in the page source says href="javascript:openimagewin('JCCOGetImage.jsp? refnum=DN2007036179');" tabindex=-1> So, in summary, when I download this page, for each record, I would...
0
1912
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi all! I am having problems on installing .NET Framework 3.5 on some machines. In one machine the error is: WinVerifyTrust returned -2146762751 Wintrust not on machine Error: O arquivo 'C:\DOCUME~1\user\CONFIG~1\Temp\VSD22.tmp\WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe' foi alterado desde a sua publicação inicial.
11
2825
by: LayneMitch via WebmasterKB.com | last post by:
Hello. This is a reference file from a book I read in which the core subject is the use of 'event listeners'. I'm trying to load the file in Firefox and it's giving me an error message: Line: 5 Char: 1 Error: 'document' is undefined
0
8521
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8973
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8722
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6377
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4261
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4468
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2867
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.