开发者

silverlight accept invalid certificate

开发者 https://www.devze.com 2023-03-04 17:46 出处:网络
I\'m doing https web requests in silverlight using \"WebRequest\"/\"WebResponse\" framework 开发者_如何学编程classes.

I'm doing https web requests in silverlight using "WebRequest"/"WebResponse" framework 开发者_如何学编程classes. Problem is: I do a request to an url like: https://12.34.56.78 I receive back a versign signed certificate which has as subject a domain name like: www.mydomain.com. Hence this results in a remote certificate mismatch error.

First question: Can I somehow accept the invalid certificate, and get the WebBresponse content ? (even if it involves using other libraries, I'm open to it)

Additional details: (for those interested on why I need this scenario)

I'm trying to give a client access to a silverlight app deployed on a test server.

Client accesses the silverlight app at: www.mydomain.com/app

Then I do some rest requests to: https://xx.mydomain.com

Problem is I don't want to do requests on https://xx.mydomain.com, since that is on our productive server. For this reason I use https://12.34.56.78 instead of https://xx.mydomain.com.

Client has some firewalls/proxies and if I simply change his hosts file and map https://xx.mydomain.com to 12.34.56.78, web requests don't resolve to the mapped IP. I say this because on his network webrequests fail if I try that, on my network I can use the hosts changing without problems.

UPDATE: Fixed the problem by deploying test releases to an alternative: https://yy.domain.com and allowing the user to configure for test purposes, the base url to which I do requests to be: https://yy.domain.com.

Using an certificate that contained the IP in the subject or an alternative subject would've probably worked too, but would have cost some money to be issued by a certified provider and would not be so good because IP's might change.


After doing more research looks like Microsoft won't add this feature too soon, unless there's a scenario for non-testing/debugging uses. See: http://connect.microsoft.com/VisualStudio/feedback/details/368047/add-system-net-servicepointmanager-servercertificatevalidationcallback-property

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号