Reputation: 87167
I know I can do this through code using
myClient.ClientCredentials.UserName.UserName = "User";
myClient.ClientCredentials.UserName.Password = "Password";
Is it possible to provide the same thing for a client through configuration instead?
Upvotes: 2
Views: 2298
Reputation: 633
It's not possible out of the box. More importantly it wouldn't be very secure either.
Anyone who has access to the config file would then have the credentials for the service. For a client application, this will be anyone who can run the program as they will have read access to the application install location.
Upvotes: 2
Reputation: 27431
Unfortunately, I don't think it's possible. However, you can manually read your .config file settings and set it programmatically...
clientCredentials.UserName.UserName = ConfigurationManager.AppSettings["username"];
clientCredentials.UserName.Password = ConfigurationManager.AppSettings["password"];
Upvotes: 5