Вопрос

In my PCL I am trying to call to an SSL service so I am trying to set ServerCertificateValidationCallback like so:

System.Net.ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertficate;

but it seems I can't add a reference to System.Net in my PCL and it says the type ServicePointManager does not exist.

How do I reference this in my PCL?

Это было полезно?

Решение

You can't reference this in your pcl - it isn't defined in any current portable subset.

If you need to use it, you can reference it in some of your Ui projects - eg in your setup class - or for reuse you can build a plugin to reference it for some platforms. However there are some modern platforms which simply don't support it - WindowsPhone (and perhaps windows store too?)

For more on injecting platform specific code into pcl core libraries, see http://slodge.blogspot.co.uk/2013/06/n31-injection-platform-specific.html

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top