FTP does not connect :(

Discussion in 'Questions (Windows Mobile)' started by vinians, Aug 22, 2007.

  1. vinians

    vinians Member Licensed User

    Im trying to connect to an ftp but its not working and Im testing it using the ftp DOS command and work properly. See my code, whats wrong?

    Code:
    Sub btnSincronizarAgora_Click
       ErrorLabel(ErrorConexion)
         Message = 
    "Create the object"
       
    ftp.New1
       WaitCursor(
    True)
       Message = 
    "Connecting"
       
    ftp.Open(FTP_HOST, FTP_USUARIO, FTP_SENHA)
       WaitCursor(
    False)
       ErrorLabel(ErrorListing)
       FTP_ARQUIVOS() = 
    ftp.GetEntries()
       goto go1
    ErrorConexion:
       Erro(
    "Error " & Message)
       
    Return
    ErrorListing:
       Erro(
    "Error listing the files")
       
    ftp.Close
       
    Return
    go1:
       
    ftp.Close    
    End Sub
    Remarks: FTP_HOST, FTP_USUARIO and FTP_SENHA are correctly defined
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    What error does it show (comment the ErrorLabel)?
     
  3. vinians

    vinians Member Licensed User

    ftp.Open(...) error:
    System.security.Permission.SecurityPermission error
     
  4. agraham

    agraham Expert Licensed User

    This looks to me like you probably have a .NET Framework Security settings issue. One of the design aims of .NET was to provide security levels that are impossible to achieve in non-managed code and the security settings can be tuned to achieve different levels of security appropriate to different environments.

    You need to increase the permissions that B4PPC runs under to allow it to access the Internet. I am not even going to try to advise you on how to do this and the exact way of achieving it is different under .NET 1.1 and .NET 2.0. I suggest that you Google around for ".NET security" or ".NET permissions" and see what you come up with.
     
Loading...