In my client application I have to use web service UserNameOverTransport, so I need in client set username and password like:
client.ClientCredentials.UserName.UserName = “account”;
client.ClientCredentials.UserName.Password = “password”;
Is it some best practices where store username and password?
From my point of view it isn’t good idea to store credentials in config file.
[Update]
When I asked this question I though that WCF provide some standard ability to store credentials in config file or have ability to setup with help of endpoints behaiviours.
The example which I looked for is solution by the following link:
http://blog.shutupandcode.net/?p=22
If you want to store credentials in the app.config/web.config, you can encrypt them using the
ProtectedDataclass or aProtectedConfigurationProvider. See the following links for more info (ordered from least detailed to most):http://geekswithblogs.net/afeng/archive/2006/12/10/100821.aspx
http://weblogs.asp.net/jgalloway/archive/2008/04/13/encrypting-passwords-in-a-net-app-config-file.aspx
http://msdn.microsoft.com/en-us/library/89211k9b%28v=vs.80%29.aspx
http://msdn.microsoft.com/en-us/library/53tyfkaw%28v=vs.80%29.aspx