Downloading .exes with WebClient.DownloadFile

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm having a problem using the System.Net.WebClient to download .exes from a web server. I'm testing everything on localhost, and the same code works fine with all other types of file. I even tried renaming the .exe extension of the file in question to .exe2, and that worked! Is there a security setting that doesn't let me download executables (the only error message I get is a timeout)? If so, is there a way to override it... I'm making a tool to update my software product over the Internet, and being able to download .exes is essential

Any suggestions, please?
 
Hi James,

Currently I am looking for somebody who could help you on it. We will reply
here with more information as soon as possible.
If you have any more concerns on it, please feel free to post here.


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
Hello,

Thanks for your post. As I understand, the problem you are facing is it
fails to download .exe fils by using WebClient. Please correct me if there
is any misunderstanding. I think more information is needed before moving
forward:

1. Could you download the file in Internet Explorer?

2. What's the error/exception message do you receive when it fails to
download?

3. Do you connect the Web Server via proxy?

I look forward to your reply. Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Check to see if the server allows you to download exe types. It may be
blocking downloads of executables.

James said:
I'm having a problem using the System.Net.WebClient to download .exes from
a web server. I'm testing everything on localhost, and the same code works
fine with all other types of file. I even tried renaming the .exe extension
of the file in question to .exe2, and that worked! Is there a security
setting that doesn't let me download executables (the only error message I
get is a timeout)? If so, is there a way to override it... I'm making a tool
to update my software product over the Internet, and being able to download
..exes is essential!
 
Thanks for your help... in response to your queries

1) No, I couldn't download the file in Internet Explorer. The progress bar at the bottom-right moved extremely slowly, and finally an error page showed: "CGI Timeout: The specified CGI application exceeded the allowed time for processing. The server has deleted the process". For all other files, there was no problem. It can't be file size either, as the .exe is only 340kb, and as I said renaming the extension works fine

2) When it fails to download and error handling is disabled, I receive a "timeout" message, after a long time in which the program does not respond

3) I don't really know what proxy is, I'm afraid! I am connecting through a wireless network in my home, which I set up myself and has no security features that I know of. I've checked through the IE security settings, and have found no applicable restrictions

Hope this helps..

James.
 
And I've just found something else! Every time I try to download the file, either in Internet Explorer or my program, it starts (and does not close) a new process which is visible in the Task Manager. This process has the same name as my file ("TMI Management.exe"). If I close this process before the usual timeout error occurs, I receive the following error: "CGI Error: The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: [blank]". It occurred to me that the computer may be trying to run, rather than download, the file. But I can't download notepad.exe either, so it's not specifically my application

Please advise

James.
 
Hello James,

Thanks for your information. The following KB article discusses the similar
issue, please check if it helps.

Browser Stops Responding When .Exe File Attempts to Run Instead of Download
http://support.microsoft.com/?id=185379

I look forward to your response.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Okay thanks, removing execute permissions worked... but only for a while. Now whenever I try to download .exes (in both my app and Internet explorer), I receive an error: "An exception 'System.IO.FileNotFoundException' has occurred in IEExec.exe" and the option to debug (disassembly only)

I have no idea what I did to cause this new problem, as for a few hours everything worked smoothly. I've just tried re-installing the .NET framework, with no results, and I've got no idea what's wrong. I'd really appreciate some help asap! Thanks

James.
 
Hello James,

Thanks for your response.

1. Does the .exe file downloaded?

2. I suggest you to monitor the file access by using FileMon.exe which can
be downloaded from http://www.sysinternals.com/ntw2k/source/filemon.shtml.

3. Based on my research, I found the similar problem which was caused by
setting cache-control: no-cache header at IIS server. I suggest you to
perform the following steps:

a. Go to "Control Panel" -> "Administrative Tools" -> "Internet Information
Services Manager".
b. Right click "Web Sites" -> "Default Web Site", choose "Properties".
c. Select "HTTP Headers" and make sure "cache-control: no-cache" is not
listed.

Hope this helps.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Thanks a lot, but somehow the problem has resolved itself again. I'm pretty sure there's something wrong with my computer

James.
 
Back
Top