对于基于Internet的应用,基于用户名和密码的认证方式是最为常用的,而WCF为你提供了不同模式的用户名认证方式。首先还是从用户凭证的表示说起。

基于用户名/密码的用户凭证通过类型UserNamePasswordClientCredential表示。而在ClientCredentials中,只读属性UserName表示这样一个用户凭证。你可以按照Windows凭证的方式为ChannelFactory<TChannel>或者ClientBase<TChannel>基于用户名/密码凭证。

class ClientCredentials
   2: {
//其他成员
public UserNamePasswordClientCredential UserName { get; }
   5: } 
class UserNamePasswordClientCredential
   7: {
//其他成员
string Password {get; set; }
string UserName { get; set; }
  11: }

相关文章:

  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-21
  • 2021-05-31
猜你喜欢
  • 2021-06-14
  • 2022-02-11
  • 2021-11-22
  • 2021-10-22
相关资源
相似解决方案