【问题标题】:Impersonate and encrypt user account to call Web Service from ASP.NET application模拟和加密用户帐户以从 ASP.NET 应用程序调用 Web 服务
【发布时间】:2012-09-04 11:45:14
【问题描述】:

我有一个 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>

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

【问题讨论】:

  • 你想加密什么? webconfig中的凭据?您的应用程序和网络服务之间的流量?
  • 谢谢!我想加密 webconfig 中的凭据

标签: asp.net web-services encryption impersonation


【解决方案1】:

将您的凭据添加到应用设置部分。然后使用 aspnet_regis 工具加密该部分

How to encrypt one entry in web.config

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

最好的问候。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-10-19
  • 1970-01-01
  • 2018-02-08
  • 1970-01-01
  • 2014-02-24
  • 1970-01-01
相关资源
最近更新 更多