本文介绍了Soapcontext.security已过时.怎么改呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码在此行中引发错误
Hi, my code throws error in this line
cliente.RequestSoapContext.Security.Tokens.Add(clientToken);
这是错误:
(SoapContext.Security已过时.请考虑从SendSecurityFilter或ReceiveSecurityFilter派生并创建一个生成这些过滤器的自定义策略断言.)
我的问题是. ¿如何重写?
这是我的代码:
this is the error:
(SoapContext.Security is obsolete. Consider deriving from SendSecurityFilter or ReceiveSecurityFilter and creating a custom policy assertion that generates these filters.)
My question is. ¿how to rewrite it?
this is my code:
service.WEBSERVICEPINES client = new service.WEBSERVICEPINES();
SecurityToken clientToken = X509TokenProvider.CreateToken(StoreLocation.LocalMachine, StoreName.TrustedPeople, this.snCertificado, X509FindType.FindByThumbprint);
MessageSignature sig = new MessageSignature(clientToken);
client.RequestSoapContext.Security.Tokens.Add(clientTeoken);
client.RequestSoapContext.Security.Elements.Adde(sig);
client.RequestSoapContext.Security.Tokens.Add(new UsernameToken(usuario, password, 2));
非常感谢您的建议.
我尝试过的事情:
Thank you so much for your advices.
What I have tried:
Service serviceProxy = new Service();
UsernameToken token = new UsernameToken("admin", "nimda", PasswordOption.SendPlainText);
serviceProxy.SetClientCredential(token);
serviceProxy.SetPolicy("ClientPolicy");
推荐答案
这篇关于Soapcontext.security已过时.怎么改呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!