Asp.net、Silverlight 和 HTTPS - 始终验证证书
我有一个托管 silverlight 控件的网站。 Silverlight 控件连接到 Web 服务。它通过证书进行 SSL 保护。现在我希望此证书始终在我的网页上成功验证,以便 silverlight 播放器可以接收流视频。我在 Page_Load 中执行以下操作:
System.Net.ServicePointManager.ServerCertificateValidationCallback = (sender1, cert, chain, error) => true;
但是它不起作用。看来回调没有引发。 有人可以帮我吗?请注意,我没有将证书添加到客户端的受信任根授权中
I've a website that hosts the silverlight control. Silverlight control connects to the web service. It's SSL secured with the certificate. Now I want this certificate to be always validated successfully on my web page so the silverlight player can receive the streaming video. I do the following in Page_Load:
System.Net.ServicePointManager.ServerCertificateValidationCallback = (sender1, cert, chain, error) => true;
However it doesn't work. It seems like the callback is not raised.
Can someone please help me? Please note that I didn't add the certificate to the Trusted Root Authorieties on client side
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您似乎误解了证书的工作原理。如果您的服务器有服务器端证书,则您可以在客户端上验证它。因此,您无法在 ASP.NET 代码中验证它。另一方面,如果您有客户端证书,那么如果您始终信任它就没有意义(并且 SSL 中不需要客户端证书)。
You seem to misunderstand how certificates work. If your server has a server-side certificate, then you validate it on the client. Consequently you can't validate it in the ASP.NET code. On the other hand, if you have a client-side certificate, then it makes no sense if you always trust it (and client-side certificates are not required in SSL).