0

我有一个ASP.NET Web 窗体应用程序,我需要模拟一个帐户来连接到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>

如果是这种情况,我如何从代码中检索它们?谢谢

4

1 回答 1

1

Add your credentials to the app settings section. Then encrypt that section using aspnet_regis tool

How to encrypt one entry in web.config

http://www.dotnetprofessional.com/blog/post/2008/03/03/Encrypt-sections-of-WebConfig-or-AppConfig.aspx

Best regards asere.

于 2012-09-11T14:12:37.887 回答