Advertisement

02.04.2008 at 02:01PM PST, ID: 23136471
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

How to FTP file using VB.net

I need to FTP a file i created using VB.net.I am writing a console application.
Start your free trial to view this solution
Question Stats
Zone: Microsoft
Question Asked By: zameer21
Solution Provided By: GreenGhost
Participating Experts: 2
Solution Grade: B
Views: 101
Translate:
Loading Advertisement...
02.04.2008 at 02:12PM PST, ID: 20818595

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.04.2008 at 07:01PM PST, ID: 20820278

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.05.2008 at 08:19PM PST, ID: 20829464

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.05.2008 at 08:42PM PST, ID: 20829557

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.05.2008 at 08:46PM PST, ID: 20829577

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.05.2008 at 11:48PM PST, ID: 20830229

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.12.2008 at 06:54AM PST, ID: 20875218

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.12.2008 at 07:30AM PST, ID: 20875624

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.12.2008 at 11:13AM PST, ID: 20877724

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.13.2008 at 08:34AM PST, ID: 20885621

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.13.2008 at 04:28PM PST, ID: 20889857

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.13.2008 at 05:23PM PST, ID: 20890135

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
02.04.2008 at 02:12PM PST, ID: 20818595
Here's a class you could download free and use it.

http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=DD5E4A38-7F5B-45E0-9C36-64B987947C20

Download the Class.. then at the bottom you'll find the example code how to use it... I've pasted it here.  Just the example part.  You need to just add the clsFTP.vb file to your project, or use the FTP.dll in your Bin folder.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
    '
    ' Copy and paste the code below into a VB WebForm or WinForm
    '  application and then do the following:
    '
    '       1).  From within the ASP.NET or WinForm app set a
    '            reference to the FTP.dll and BitOperators.dll
    '            files.
    '       2).  At the top of the application code file 
    '            (E.g WebForm1.aspx.vb or Form1.vb) type in
    '               Imports FTP
    '       3).  Compile the application and run.
    '       4).  Have fun.
 
    'Protected Sub TestFTP()
    '    Dim ff As clsFTP
 
    '    Try
    '        '-------------------------------------------
    '        ' OPTION 1
    '        ' --------
    '        '
    '        ' Create an instance of the FTP Class.
    '        'ff = New clsFTP()
 
    '        ' Setup the appropriate properties.
    '        'ff.RemoteHost = "microsoft"
    '        'ff.RemoteUser = "ftpuser"
    '        'ff.RemotePassword = "password"
    '        '-------------------------------------------
 
    '        '-------------------------------------------
    '        ' OPTION 2
    '        ' --------
    '        '  Pass the values into the constructor 
    '        '  instead.  These can be overridden by simply
    '        '  setting the appropriate properties on the
    '        '  instance of the clsFTP Class.
    '        ff = New clsFTP("microsoft", _
    '                        ".", _
    '                        "ftpuser", _
    '                        "password", _
    '                        21)
 
    '        ' Attempt to log into the FTP Server.
    '        If (ff.Login()) Then
    '            '
    '            ' Move the to Area1\Section1\Subby1\ directory.
    '            ff.ChangeDirectory("Area1")
    '            ff.ChangeDirectory("Section1")
 
    '            'ff.CreateDirectory("Subby1")
    '            ff.ChangeDirectory("Subby1")
    '            ff.SetBinaryMode(True)
 
    '            ' Upload a file.
    '            'ff.UploadFile("d:\general\secureapps.pdf")
 
    '            ' Download a file.
    '            'ff.DownloadFile("secureapps.pdf", "d:\general\secureapps.pdf")
 
    '            ' Remove a file from the FTP Site.
    '            If (ff.DeleteFile("secureapps.pdf")) Then
    '                Response.Write("File has been removed from FTP Site")
    '                'MessageBox.Show("File has been removed from FTP Site")
    '            Else
    '                Response.Write("Unable to remove file from FTP Site.  Message from server: " & ff.MessageString & "<br>")
    '                'MessageBox.Show("Unable to remove file from FTP Site")
    '            End If
 
    '            ' Rename a file on the FTP Site.
    '            'If (ff.RenameFile("secureapps.pdf", "newapp.pdf")) Then
    '            '    Response.Write("File has been renamed")
    '            '    MessageBox.Show("File has been renamed")
    '            'End If
 
    '            'ff.ChangeDirectory("..")
    '            'If (ff.RemoveDirectory("Subby1")) Then
    '            '    Response.Write("Directory has been removed<br>")
    '            '    ' MessageBox.Show("Directory has been removed")
    '            'Else
    '            '    Response.Write("Unable to remove the directory.  Message from server: " & ff.MessageString & "<br>")
    '            '    ' MessageBox.Show("Unable to remove the directory.")
    '            'End If
    '        End If
 
    '    Catch ex As System.Exception
    '        ' ASP.NET
    '        Response.Write(ex.Message & "<BR>")
    '        Response.Write("Message from FTP Server was: " & ff.MessageString)
 
    '        ' WinForms
    '        'Messagebox.Show(ex.Message)
    '        'MessageBox.show("Message from FTP Server was: " & ff.MessageString)
    '    Finally
    '        '
    '        ' Always close down the connection to ensure that
    '        '  there are no "stray" Fido's Fetching data.  In
    '        '  other words, no stray/limbo/not-in-use FTP
    '        '  connections.
    '        ff.CloseConnection()
    '    End Try
    'End Sub
Open in New Window
Assisted Solution
 
02.04.2008 at 07:01PM PST, ID: 20820278

Rank: Guru

There is no need to download anything, it's already built into the framework.

You can use the UploadFile method in the WebClient class to send a file to an FTP server:

http://msdn2.microsoft.com/en-us/library/36s52zhs(VS.80).aspx

However, you don't even have to save the data to a file to upload it, you can use the UploadData method to send a byte array as a file to the FTP.
Accepted Solution
 
02.05.2008 at 08:19PM PST, ID: 20829464
Hi Greenhost,
i looked at the code in the link you send me,there is no place to put username and password.I need to ftp to a remote host with username and password.
 
02.05.2008 at 08:42PM PST, ID: 20829557
Could just use the class I linked you too.

    '        ' Create an instance of the FTP Class.
    '        'ff = New clsFTP()
 
    '        ' Setup the appropriate properties.
    '        'ff.RemoteHost = "microsoft"
    '        'ff.RemoteUser = "ftpuser"
    '        'ff.RemotePassword = "password"

 
02.05.2008 at 08:46PM PST, ID: 20829577
Hi FredMastro,
I am presenlty thinking of using ur class,i need to test it.I will be only able to do it tomm or day after, as i dont have all the ftp info yet.
 
02.05.2008 at 11:48PM PST, ID: 20830229

Rank: Guru

To set the user name and password for a WebClient object, you use the Credentials property:

myWebClient.Credentials = New NetworkCredential (username, password);
 
02.12.2008 at 06:54AM PST, ID: 20875218
GreenGhost,
where do u specify the remote host in the code you gave me.
 
02.12.2008 at 07:30AM PST, ID: 20875624
i GOT IT GREENHOST,
Is there way to determine if the file was written succesfully,through code.
UploadMathod returns Byte().What is this byte() array for.
 
02.12.2008 at 11:13AM PST, ID: 20877724

Rank: Guru

The method returns the response from the server.

I'm not certain what the FTP server returns as response, but I think that it's a message like "250 File action completed". You can use the Encoding.ASCII.GetString to decode the bytes into a string.
 
02.13.2008 at 08:34AM PST, ID: 20885621
GreenGhost:
I can write the file to the FTP server,but byte code returned when i use encoding.ascii.getstring is blank.
I would prefer to have sucees to failure so that i can write to the log.
 
02.13.2008 at 04:28PM PST, ID: 20889857

Rank: Guru

If there is something wrong, you will get an exception.

The method that I suggested for getting the resonse is also used in the example in the documentation for the UploadFile method:

http://msdn2.microsoft.com/en-us/library/aa329789.aspx
 
02.13.2008 at 05:23PM PST, ID: 20890135
I tried all that i was not particluarly happy with what it returns,
But i found another solution through code that uses FTPWebclient it is better and returns a better code,if you file was transmitted.I will divide points between GreenGhost and FredMastro,I dont like to use other dll,if i could code it myself.
 
 
02.13.2008 at 11:12PM PST, ID: 20891532
> code that uses FTPWebclient

Do you mean FtpWebRequest?
 
 
02.14.2008 at 02:37PM PST, ID: 20897654
yes thats correct FTPWEbRequest
 
 
02.14.2008 at 02:49PM PST, ID: 20897736
Yes, that would work too. The WebClient class is easier to use, but if you want a bit more control, the FtpWebRequest class is fine. Though it should still return the same response from the server for the same operation.
 
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628