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.

Recommended Answers

All 6 Replies

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.

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.

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 ).

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.

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.

Ok thats enough help. I'll try it right away. Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.