C # A summary of FTP Development

Source: Internet
Author: User

In general, C # provides a very simple FTP method. The encapsulated ftpwebrequest and ftpwebresponse make FTP module development very simple. However, after encapsulation, many custom customization problems may occur, which are not detailed here. The following are some of the problems encountered during this period:

 
Try{This. Ftpuri =NewUri (ftppath );This. Webrequest = (ftpwebrequest) webrequest. Create (ftpuri );If((Bool) Radiobutton_binary.ischecked) {webrequest. usebinary =True;}Else{Webrequest. usebinary =False;} Webrequest. Credentials =NewNetworkcredential (ftpconfig. ftpusername, ftpconfig. ftppasswd );}

AboveCodeContent initialized for the FTP connection. Webrequest. method = webrequestmethods. FTP. uploadfile; method indicates the FTP operation to be performed. However, the above Code operation is required for each operation during FTP encapsulation,
Ftpwebrequest does not provide a session persistence mechanism (or is it provided, I have not found it? Can't automatically keep the session after the connection times out like some FTP tools. networkcredential is an unpleasant operation every time.

During PS file upload, you can use delegate to keep the UI active. Multi-threading is preferred for uploading multiple files.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.