我有一个ASP.NET Web窗体应用程序,我需要模拟一个帐户以连接到一个Web服务。应用程序始终与同一个帐户连接,并且必须加密。模拟并加密用户帐户以从ASP.NET应用程序调用Web服务
客户是MyWebServiceClient()
我的代码是:
MyWebService.MyWebServiceClient client = new MyWebService.MyWebServiceClient();
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
client.ClientCredentials.Windows.ClientCredential = new NetworkCredential(username, password, domain);
而且它完美的作品。问题是如何加密这些数据。是否有可能在Web服务绑定内的web.config中执行它?
<security mode="TransportCredentialOnly">
transport clientCredentialType="Windows" realm="" />
<security>
如果是这样的话,我该如何从代码中检索它们?谢谢
你想加密什么? webconfig中的凭据?您的应用程序和webservice之间的流量? – Oscar
谢谢!我想加密webconfig中的凭证 – CiccioMiami