Bonsoir à tous et Bonne année 2013
Lors d'un développement mobile pour Windows Phone OS 7.1, j'ai voulu, pour réaliser une requête Get en https en utilisant la méthode décrite ici: http://stackoverflow.com/questions/6...ice-over-https
et ici:
http://www.terminally-incoherent.com...equest-with-c/
Voici donc mon code:
L'interface ICertificatePolicy et l'objet ServicePoint (utilisé pour les paramètres de la méthode CheckValidationResult) ne sont pas détectés par Visual Studio 2010 et la compilation ne marche donc pas :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 using System; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.Security.Cryptography.X509Certificates; namespace Digihome.Model { public class myPolicycs : ICertificatePolicy { public myPolicycs() { } public bool CheckValidationResult(ServicePoint srvPoint, X509Certificate certificate, WebRequest request, int certificateProblem) { //Return True to force the certificate to be accepted. return true; } } }
Model\myPolicycs.cs(15,31): error CS0246: The type or namespace name 'ICertificatePolicy' could not be found (are you missing a using directive or an assembly reference?)
\Model\myPolicycs.cs(21,43): error CS0246: The type or namespace name 'ServicePoint' could not be found (are you missing a using directive or an assembly reference?)
Les références system et System.Net sont pourtant bien présentes dans le projet. J'ai aussi essayé System.Net.ICertificatePolicy mais je n'ai pas eu plus de succès. Je me suis alors demandé si Silverlight et Windows Phone supportaient ces objets mais Google n'a signalé aucun problème à ce niveau là. Vous avez une idée du problème SVP?
Partager