I have an ASP.NET Web Forms application and I need to impersonate an account to connect to a Web Service. The application always connects with the same account and has to be encrypted.
The client is MyWebServiceClient()
my code is:
MyWebService.MyWebServiceClient client = new MyWebService.MyWebServiceClient();
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
client.ClientCredentials.Windows.ClientCredential = new NetworkCredential(username, password, domain);
And it works perfectly. The problem is how to encrypt these data. Is it possible to do it inside the web.config within the web service binding?
<security mode="TransportCredentialOnly">
transport clientCredentialType="Windows" realm="" />
<security>
If that is the case, how can I retrieve them from code? Thanks