How to Download a file or .exe in C# programming

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2008
Posts: 11
Reputation: Umair.P is an unknown quantity at this point 
Solved Threads: 0
Umair.P Umair.P is offline Offline
Newbie Poster

How to Download a file or .exe in C# programming

 
0
  #1
Aug 18th, 2008
Hi there. I am new to this forum. I would like to know how can I download a file or .exe from a server on to the client machine. My software will run on the client machine. I want to know if there is some built in functionalty in windows that I may use.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,160
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 137
dickersonka dickersonka is offline Offline
Veteran Poster

Re: How to Download a file or .exe in C# programming

 
0
  #2
Aug 18th, 2008
I don't know what your method of calling the server is, or if it is local or remote. You might want to try a web service if you can't access the file publicly. If its public it can just be a url. In the C# code, you can reference a file as a byte array( byte[]). If you need further clarification, please supply a little bit more detail.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: How to Download a file or .exe in C# programming

 
0
  #3
Aug 18th, 2008
Assuming you know the full URL then theres a good set of options built in HttpWebRequest and HttpWebResponse classes, see if that helps you find the right answer.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 11
Reputation: Umair.P is an unknown quantity at this point 
Solved Threads: 0
Umair.P Umair.P is offline Offline
Newbie Poster

Re: How to Download a file or .exe in C# programming

 
0
  #4
Aug 18th, 2008
I am developing a desktop application that will check the server for updates and if found will download the update. The update has to be in exe form since it will contain its own logic. I wan to know if there is a built in control in .NET or any window functionality that I might use to download an exe. once downloaded the exe will execute and update my system.
Note: The system is already able to check for updates on the server ( there is a webservice already running on the server ).
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,735
Reputation: LizR has a spectacular aura about LizR has a spectacular aura about 
Solved Threads: 186
LizR LizR is offline Offline
Posting Virtuoso

Re: How to Download a file or .exe in C# programming

 
0
  #5
Aug 18th, 2008
As I said, the above will as long as you know what the URL will be.. wether its http://mysite.com/download.asp or what..as long as you know how to get the URL and how to test if theres a newer exe - either by praying the server displays correct headers or in your case maybe a version.txt file, the principle is the same. Have a look at those 2 objects and work from there.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,160
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 137
dickersonka dickersonka is offline Offline
Veteran Poster

Re: How to Download a file or .exe in C# programming

 
0
  #6
Aug 18th, 2008
Since there is a webservice in place. Download the file as a byte[], save it to the file system using System.IO.File. Then call Process.Start on the exe file, making sure to exit your program if it will be part of the files being updated.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 11
Reputation: Umair.P is an unknown quantity at this point 
Solved Threads: 0
Umair.P Umair.P is offline Offline
Newbie Poster

Re: How to Download a file or .exe in C# programming

 
0
  #7
Aug 18th, 2008
Ok thats enough help. I'll try it right away. Thanks
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC