Access to path 'C:\' is denied

Apr 30, 2012 at 11:08 AM
Edited Apr 30, 2012 at 11:08 AM

Hi Alex,

I am using the alex ftps client library in my application. I can set the connection but when I try to download a file I get this error: 

 "Access to path 'C:\' is denied"

 

Here is my code:

 

Dim client As FTPSClient = New FTPSClient()

client.Connect(server.Value, New NetworkCredential(user.Value, pass.Value), ESSLSupportMode.All, New Security.RemoteCertificateValidationCallback(AddressOf VerifyServerCertificate))

client.GetFile("/documentos/Enviados/Test.txt", "C:\\")

client.Close()


Best Regards.
Ana Silva


Coordinator
Apr 30, 2012 at 11:11 AM

Ana,

did you check that you have permissions to create files / directories in c:\ ?

 

Alessandro

Apr 30, 2012 at 11:21 AM

Alex,

Thanks for the quick response. Yes I have permitions  to create files in c:\.

 

Regards,

Ana

Coordinator
Apr 30, 2012 at 11:38 AM

The error is returned by .Net's System.IO classes, so it's a permission issue. 

 

Your code is running in an application, a service or a web site, etc?

What is the user running the app in case?

UAC is enabled?

 

Best,

Alessandro

Apr 30, 2012 at 11:58 AM

It's an application and my user is on the Administrator group of users.

The UAC is set to Never notify.

 

I tried to create a file with a  System.IO.StreamWriter:  

 

Dim SR As StreamWriter = New StreamWriter("C:\Test.txt", True, Text.Encoding.ASCII)

and there was no error.

In the mean wile I was trying to use the GetFiles function: 

client.GetFiles("/roff/Documentos/Exportados/", "C:\\", ??, EPatternStyle.Verbatim, True, ???)

 but I don't know how to set the filePattern and the AlexPilotti.FTPS.Client.FileTransferCallback. Can you send me an example please?

Best Regards,

Ana Silva

Coordinator
Apr 30, 2012 at 12:03 PM
Edited Apr 30, 2012 at 12:03 PM

I noticed that you are using "C:\\". That's the C# escape, in VB "C:\" is enough.

You can refer to the sources of the command line client as a sample fro GetFiles.

You don't need a transfer callback, unless you want to track transfer progress.

You might just use a Wildcard pattern specifying "*" or "*.*"

 

Alessandro

Apr 30, 2012 at 2:11 PM

I tried "C:\" but I get the same error.

Now I'm trying the client.GetFiles("C:\", "*.*", EPatternStyle.Wildcard, True) and I get this error : "Unable to parse the directory list"!

 

Regards,

Ana Silva