473,322 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

connection to FTP server

I am trying to connect to a FTP server using the FtpWebRequest class in
visual basic 2005. Right now, I am merely trying to get a list of files
on the server. I have the IP address, the username and password to the
server. I also had to install a certificate in my browser. I get a "The
specified network password is not correct" - error when trying to test
the code. I get it after the Client certificates statement.

Public Shared Function ListFilesOnServerSsl(ByVal serverUri As Uri) As
String

Dim username As String = "username"
Dim password As String = "password"
Dim retStr As String = ""

' The serverUri should start with the ftp:// scheme.
If Not (serverUri.Scheme = Uri.UriSchemeFtp) Then
retStr = ""
Else
'Get the object used to communicate with the server.
Dim request As FtpWebRequest =
CType(WebRequest.Create(serverUri), FtpWebRequest)
request.Credentials = New NetworkCredential(username,
password)
request.ClientCertificates.Add(X509Certificates.X5 09Certificate.CreateFromCertFile("C:\certificate.p fx"))
request.Method = WebRequestMethods.Ftp.ListDirectory
request.EnableSsl = True
'Get the ServicePoint object used for this request
Dim sp As ServicePoint = request.ServicePoint
sp.ConnectionLimit = 2
Dim Response As FtpWebResponse = CType(request.GetResponse,
FtpWebResponse)

'The following streams are used to read the data returned
from the server.
Dim responseStream As Stream = Nothing
Dim readStream As StreamReader = Nothing
Try
responseStream = Response.GetResponseStream
readStream = New StreamReader(responseStream,
System.Text.Encoding.UTF8)
If Not (readStream Is Nothing) Then
retStr = readStream.ReadToEnd()
End If
Finally
If Not (readStream Is Nothing) Then
readStream.Close()
End If
If Not (Response Is Nothing) Then
Response.Close()
End If
End Try
End If

Return retStr
End Function
End Class

I made sure the username and password are correct. Can someone point
out where I am going wrong?

Sep 5 '06 #1
0 999

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Fortepianissimo | last post by:
Here is the situation: I want my server started up upon connection. When the first connection comes in, the server is not running. The client realizes the fact, and then starts up the server and...
6
by: Paul Robinson | last post by:
I am developing a website in ASP that connects to a Sybase database. However, when I try to open a connection to the database the page will not load. The script does not timeout, nor the...
5
by: Fred Zuckerman | last post by:
Hello All, After reading in this group about the preference for connecting to a SQL Server using a connection string instead of a DSN file, I have done just that. BUT, I cannot update my data....
6
by: Sharon | last post by:
Hi all. I'm trying first time async socket connection. In all the examples i've seen, the server connection is closed when the message is complete. Is it common to close the connection after...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
5
by: Suresh | last post by:
Hi Guys I have Db2 server installed on remote server. i am connecting to that remote server by using VPN. I want to connect that remote DB2 server instance using my local machine DB2...
16
by: crbd98 | last post by:
Hello All, Some time ago, I implemented a data access layer that included a simple connectin pool. At the time, I did it all by myself: I created N connections, each connection associated with...
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
2
by: Johnson | last post by:
I'm trying to fix a "sub optimal" situation with respect to connection string management. Your thoughtful responses will be appreciated. I just started with a new client who has a bunch of legacy...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.