I've starting using C# a while ago and started a nice project to help my company maintiance PC profiles.
This application i'm writing connects to AD and retrieves a users email and with the push of a button changes a users profile to .old so he can login agian with a fresh windows profile.
I want to protect the communication with AD and the application by puttin the password in a secure string.
And i was looking for some feedback if i have done this correctly.
The follwing code bit shows the secure string and Authenticate a bit of the Authenticate process.
Any suggestions or critisism is welcome.
Thanks in advance.
privatevoid btnLogIn_Click(object sender, EventArgs e)
string PwProtect = txtPassword.Text;
char PasswordChars = PwProtect.ToCharArray();
SecureString Password = new SecureString();
foreach (char c in PasswordChars)
if (Authenticate(txtLogIn.Text, txtPassword.Text))
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch