FTP Login using Windows Credentials

主宰稳场 提交于 2019-12-11 10:27:33

问题


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:


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




回答2:


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



来源:https://stackoverflow.com/questions/319752/ftp-login-using-windows-credentials

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!