FTP upload and download with. Net

Source: Internet
Author: User
Tags ftp client filezilla filezilla ftp filezilla ftp client
Introduction to FTP

Dedicated to file upload, download, more efficient

Common FTP servers under Windows: Serve-u, IIS FTP, FileZilla server (free, open source). Learn to use FileZilla Server (after decompression to run again).

Common FTP clients under Windows: Windows built-in (command line Ftp.exe, Resource Manager), CuteFTP (billing), FlashFXp, FileZilla FTP client. Someone with a computer explorer problem, you can use FileZilla FTP Client.

First, build the server

Logon FTP generally requires user name, password, according to the different user name has different permissions (files: Upload, download, delete, attach; directory: Create, delete), different users can see different directories; If you do not enter the user name is considered an anonymous user, in fact, is the user named anonymous users, Anonymous users generally only give download permissions.
public static void Ftpdownload ()
{
FTP operation with a simple WebClient from. Net
WebClient easy to operate, but few functions, for simple upload, download
WebClient WC = new WebClient ();
Create login Username
Wc. Credentials = new NetworkCredential ("Test", "12345");
Upload file "Ftp://127.0.0.1" is the name of the server
Wc. UploadFile ("Ftp://127.0.0.1/2.xls", "C:\\1.xls");
Download files
Wc. DownloadFile ("Ftp://127.0.0.1/1.xls", "c:\\1.txt");
Console.WriteLine ("Write Success");
}



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.