-
Vb 2005 ftp ssl
I wrote a small ftp program to transfer a file FTP.
I want to use FTP over SSL, but when I enable the SSL property, I still get connection errors. My connection script worked fine as ftp, but I'm not sure if I have to exchange a certificate now, or if it should be automatic???
Anyone know where i can find some sample code for this??
Thanks 
..I can submit the code, and i dont care what i connnect to for testing as long as its ssl-ftp.
-
-
Imports System.Net
Imports System.IO
Imports System.Security.Cryptography.X509Certificates
'System.Net.FtpWebRequest.EnableSsl
Public Class Form1
Private Sub Uploader1(ByVal source As String, ByVal target As String, _
ByVal credential As NetworkCredential)
Dim request As FtpWebRequest = _
DirectCast(WebRequest.Create(target), FtpWebRequest)
Dim tempCert As X509CertificateCollection
request.Method = WebRequestMethods.Ftp.UploadFile
request.Credentials = credential
request.EnableSsl = True '***********************
tempCert = request.ClientCertificates
request.ClientCertificates = tempCert
Dim reader As New FileStream(source, FileMode.Open)
Dim buffer(Convert.ToInt32(reader.Length - 1)) As Byte
reader.Read(buffer, 0, buffer.Length)
reader.Close()
request.ContentLength = buffer.Length
Dim stream As Stream = request.GetRequestStream
stream.Write(buffer, 0, buffer.Length)
stream.Close()
Dim response As FtpWebResponse = DirectCast(request.GetResponse, FtpWebResponse)
MsgBox((response.ExitMessage))
response.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim credential As New NetworkCredential("test", "test")
Uploader1("c:\text1.txt", "ftp://put server here/text1.txt", credential)
End Sub
End Class
-
anyone???
-
-
i looked at the zip. It doesnt look like they are exchanging any certificates. Anyone know of a simple sftp program i can test it on? Maybe the one i was using was the problem.
-
The first one that comes to mind is ipswitch WS_FTP (there is an eval)
http://www.ipswitch.com/products/ws_...asp?t=features
-
thats actually the one i was having trouble with. Probly somthing ive overlooked. Ill try again.
Thanks.
-
I don't think FtpWebRequest is able to support SSL connections. What is unclear is whether it is using implicit or explicit SSL, which may be part of the problem.
you might want to look at the following ftp .net api. It supports both implicit and explicit SSL connections so may work for you.
Similar Threads
-
Replies: 2
Last Post: 01-04-2007, 01:18 AM
-
Replies: 6
Last Post: 01-02-2007, 09:41 PM
-
By Javfarary in forum .NET
Replies: 1
Last Post: 01-02-2007, 07:55 PM
-
By Javfarary in forum .NET
Replies: 4
Last Post: 12-23-2006, 01:55 AM
-
Replies: 0
Last Post: 05-17-2006, 12:17 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks