1
我需要做一個GET請求頭(這是requeriment),但我收到協議衝突異常。HttpWebRequest GET ProtocolViolationException WP7
這是我的代碼:
System.Uri targetUri = new System.Uri("http://54.219.33.208:8080/wsrewards/consultaEstatusRewards");
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(targetUri);
request.Method = "GET";
request.Headers["idUser"] = user;
request.Headers["auth"] = autho;
request.BeginGetRequestStream(new AsyncCallback(ReadWebRequestStreamCallbackConsultaEstatusRewards), request);
還有一件事。您應該考慮使用異步等待的代碼。與例如這些異步回調相比,這些異步回調更難以調試。 'var response =(HttpWebResponse)await request.GetResponseAsync();' – Soonts
謝謝!!!解決了問題! –
不客氣。 – Soonts