Question : send a json over a https

hi,

i dont know what i'm doing wrong
i develop a component who i want to send a json file to a https url...i using this code ...and i have the msg exepction like this "the server return (404) not found"...and i another like "The underlying connection was closed: Could not establish relationship of trust to secure channel for SSL / TLS"
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:
 System.Net.ServicePointManager.ServerCertificateValidationCallback +=
                                delegate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors sslError)
                                {
                                    bool validationResult = true;
                                    return validationResult;
                                };
                           string url = "https://"+ApplicationId+"."+ Settings._defaultServer + "/sendData"; 
                           HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url) ;                          
                           request.ContentType = "application/x-www-form-urlencoded";                           
                           request.Method = "POST";
                           using (StreamWriter writer = new StreamWriter(request.GetRequestStream()))
                           {
                               writer.Write(_json);
                           }

                           WebResponse response = request.GetResponse();
                           Stream stream = response.GetResponseStream();
                           string json = "";

                           using (StreamReader reader = new StreamReader(stream))
                           {
                               while (!reader.EndOfStream)
                               {
                                   json += reader.ReadLine();
                               }
                           } 
                        


thanks Igor

Answer : send a json over a https

i found my where ir my excption....the problem is in json format and when a post the data i forgot a param to pass with json and put a userAgent.
And my code is ok.
Random Solutions  
 
programming4us programming4us