DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 9 of 9

Thread: Vb 2005 ftp ssl

  1. #1
    Join Date
    Jan 2007
    Posts
    5

    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.

  2. #2
    Join Date
    Jan 2007
    Posts
    27
    Can you submit the code?

  3. #3
    Join Date
    Jan 2007
    Posts
    5
    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

  4. #4
    Join Date
    Jan 2007
    Posts
    5

    Question

    anyone???

  5. #5
    Join Date
    Jan 2007
    Posts
    27

  6. #6
    Join Date
    Jan 2007
    Posts
    5
    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.

  7. #7
    Join Date
    Jan 2007
    Posts
    27
    The first one that comes to mind is ipswitch WS_FTP (there is an eval)

    http://www.ipswitch.com/products/ws_...asp?t=features

  8. #8
    Join Date
    Jan 2007
    Posts
    5
    thats actually the one i was having trouble with. Probly somthing ive overlooked. Ill try again.
    Thanks.

  9. #9
    Join Date
    Mar 2005
    Posts
    22
    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

  1. Replies: 2
    Last Post: 01-04-2007, 01:18 AM
  2. Replies: 6
    Last Post: 01-02-2007, 09:41 PM
  3. Destructors in vb .net 2005
    By Javfarary in forum .NET
    Replies: 1
    Last Post: 01-02-2007, 07:55 PM
  4. C# to vb .net (2005) help
    By Javfarary in forum .NET
    Replies: 4
    Last Post: 12-23-2006, 01:55 AM
  5. VB 2005 DataSets, Strongly-Typed Data
    By bgibson in forum .NET
    Replies: 0
    Last Post: 05-17-2006, 12:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links