Ho chiesto here come rendere il post https, e ora funziona bene. Problema ora è come inviare un parametro query di nome, che è una stringa JSON:Come inviare parametri su un Https POST con C#
{ "key1": "value1", "key2": { "Key21": "val21"}}
Cosa che sto facendo e non funziona è:
HttpWebRequest q = (HttpWebRequest)WebRequest.Create(Host + ":" + Port);
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications);
q.Method = "POST";
q.ContentType = "application/json";
q.Headers.Add("JSON-Signature", GetFirma(query));
q.Credentials = new NetworkCredential(user,pass);
byte[] buffer = Encoding.UTF8.GetBytes("query=" + query);
q.ContentLength = buffer.Length;
using (Stream stream = q.GetRequestStream())
{
stream.Write(buffer, 0, buffer.Length);
}
Ma il server sempre rispondere dicendo che non c'è alcun parametro 'query'. Qualsiasi aiuto?
Grazie in anticipo!
Non ritiene la server di forse si aspettano un parametro di query nell'URL? come http: // host /? query = xyz – Lucero
Questo è quello che non so, in quanto l'unico esempio fornito dagli sviluppatori di server era su php (codice nella prima domanda) –
Vedere anche: http: //marcgravell.blogspot .com/2009/10/pass-data-simply-learning-from-jquery.html –