Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.8k views
in .NET FTP by (440 points)
I'm writing an FTP app that my users will use for transferring data. I'd like to save server connection information (host name, login name, password, etc.) so that they do not have to manually type in the information. A type of connection profile.

I'm looking for advice on how best to handle this. I'd rather not save the connection information (especially the password) in clear text. Has anyone created a similar type of profile? I'm using Visual Studio 2008.

Thx!

2 Answers

0 votes
by (51.6k points)
Here are three ways to do it:
  1. Add the connection-settings to your project properties. Open your Project Properties in VS; select the Settings tab; create a new setting with name, say, MyConnection; in the drop-down for Type, select Browse and choose EnterpriseDT.Net.Ftp.SecureFTPConnection (or ExFTPConnection). You will now be able to access the settings using Properties.Settings.Default.MyConnection. Initially it will be null, but once it's set and saved using Properties.Settings.Default.Save(), you will have a persistent connection.
  2. Use SecureFTPConnection.Save() to save all the settings of the connection to a file (use Load() to load it back in). This saves the password as plain text so I suggest that you clear it before you call the method and restore it afterwards. Alternatively you can set the Password property to a encrypted version of itself (see here) and decrypt it again after loading.
  3. Bind the relevant properties of SecureFTPConnection to ApplicationSettings. To do this click on your SecureFTPConnection in the Windows Form designer; go to the Properties view; click on (ApplicationSettings); click on the ellipsis in (PropertyBinding); assign the properties you want to save to application settings. Once you've done that, make sure that you call "Properties.Settings.Default.Save()" before exiting your application. If you do that then they will be automatically restored next time the user starts the app.


- Hans (EnterpriseDT)
0 votes
by (440 points)
Thank you, Hans.

I appreciate your assistance!

Bob

Categories

...