Silverlight 4.0 - HttpWebRequest throwing ProtocolViolationException

I get a "System.Net.ProtocolViolationException: operation is not valid due to the current state of the object." when trying to call

 var request = (HttpWebRequest)WebRequest.Create(uri);

 request.Method = "GET";

 request.ContentType = "text/xml";

 request.BeginGetRequestStream(RequestCompleted, request);
+3
source share
2 answers

I suspect that this may be due to what you are executing BeginGetRequestStreamin the request object for which you specified the GET method.

"GET" , BeginGetResponse. , ContentType , , , , , "GET" , .

+6

AnthonyWJones. HTTP, "GET" . , , , , HTTP, ( ) . , . , , BCL , .

- , , : HTTP RFC 2616

0

Source: https://habr.com/ru/post/1748047/


All Articles