开发者

How to download file from FTP server in Silverlight application?

I've developed a silverlight application, in which I offer Download Video File feature. The video files are to be downloaded from a FTP server. How can I do it?

I开发者_C百科 read FTP is not supported in silverlight, not even in silverlight 4.0. So how can I do my task? Any alternative? Would it be a good idea if I use WCF services which actually downloads from FTP and sends back the data to the silverlight client?

What other alternatives do I have?


FTP is not supported natively in Silverlight, but sockets are, so in theory you can connect to the FTP server using sockets directly (not too easy, but FTP isn't a protocol too complex). However, sockets have a limited set of ports on browser-based SL applications (IIRC between 4502 and 4535), so you'll need to change the FTP server to listen to those ports instead of the default port 21. This is not a problem in out-of-browser SL applications, so if this is an option, then you can use the default port as well.

So, I'd say that talking directly to a FTP server is possible, but frankly I wouldn't recommend it. Using a WCF (or ASMX, as shown in http://silverlightftp.codeplex.com) is going to be a lot simpler.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜