Tuesday, December 23, 2008

C# Tutorial: Using FtpWebRequest to Perform FTP Actions

Click the link to download the source code for this post

Licensing and Warranty

You may use the code as you wish - it may be used in commercial or other applications, and it may be redistributed and modified. The code is provided "as-is". No claim of suitability, guarantee, or any warranty whatsoever is provided. By downloading the code, you agree to defend, indemnify, and hold harmless the Author and the Publisher from and against any claims, suits, losses, damages, liabilities, costs, and expenses (including reasonable legal or attorneys' fees) resulting from or relating to any use of the code by you.


Before .NET 2.0, coding FTP functionality was somewhat cumbersome. You either had to purchase third-party classes and libraries or you had to spend hours coding in order for the functionality to work.

.NET 2.0 launched a number of tools to make development easier. A class called FtpWebRequest in the System.Net library makes coding FTP functionality much easier.

I have created a demonstration on how to use this class. In this demonstration, I will be creating a GUI application that will upload a file to an FTP server.

If you have any questions, please leave a comment and I will answer your question to the best of my ability. :)

The Tutorial

You can download the source code for this tutorial from the link that appears at the top of this post.

Part 1:

Part 2:

Part 3:

Additional Reading

OpenFileDialog (MSDN)
FtpWebRequest (MSDN)
Simple FTP Demo Application Using C# .NET 2.0 by Mohammed Habeeb
Uploading File using FtpWebRequest by Faraz Shah Khan


emrah ba┼čaran said...

Hi !

Thank you so much...
Your working helped us .

It is perfect

Akbar said...

Hi, Thank you so much for this demo. I have problem with changing to my server directory.
I would like to upload file into My server directory
Any idea how to do it?

Thank you

kelvin said...

hi, in youtube i just can see it at 360p from part 2, can you send me a link for 480p plz?
thxank you
myEmail : hhsjosc01@yahoo.co.jp