views:

484

answers:

2

We have a C# windows application that needs to be able to connect to a server on a network, download and save a file to a specified location. We can not use a web service as we can not assume that our clients will have IIS on their server.

The way that I am considering doing it is to FTP onto the server and download the file. I can write the code to connect to the server and located the file but I have 2 questions.

  1. Is there a way of using the windows credentials to FTP on to the remote server? (I understand that I cannot directly get the user's password).

  2. Is there a better way of getting the file from a server other than ftp-ing on to it?

Thanks for the advice.

+1  A: 

I'm assuming that a network share isn't an option (perhaps an external site etc).

Note that IIS isn't the only way of hosting a web-service. With WCF, you can use a console exe or a windows service to host the WCF service, which would allow you to run WCF on the server without any mention of IIS. See here. Then all you need is line-of-sight to the server, and some code that returns the file (or chunks of it, or a stream of it).

Marc Gravell
Thanks Marc, I did think about the WCF solution but I don't have any experience with WCF at the moment and we are looking to get this ready in the next couple of weeks.I wouldn't be too confident of getting it done in the timeframe.
Skittles
Oh and we are still using .NET 2.0 so 3-3.5 will not be installed on the server.
Skittles
+1  A: 

Depending on the size of the file (e.g. if it is less than 4MB) - you might consider leveraging a public MSMQ mechanism.

Kelvin Meeks