public override IStorageProviderSession CreateSession(ICloudStorageAccessToken token, ICloudStorageConfiguration configuration) { // cast the creds to the right type var creds = token as GenericNetworkCredentials; // check if url available int status; WebException e; _ftpService.PerformSimpleWebCall(configuration.ServiceLocator.ToString(), WebRequestMethods.Ftp.ListDirectory, creds.GetCredential(null, null), null, out status, out e); if (status == (int)FtpStatusCode.NotLoggedIn) { throw new UnauthorizedAccessException(); } if (status >= 100 && status < 400) { return(new FtpStorageProviderSession(token, configuration as FtpConfiguration, this)); } return(null); }