I simply obtained this exemption (ProtocolViolationException) in my.NET 2.0 application (working on home windows mobile 6 common emulator). What perplexes me is that regarding i understand, I have actually not included any type of material body, unless I"ve unintentionally done it in some way. My code is listed below (really basic). Exists anything else i require to do to convince.NET that this is simply a http obtain?

// run get hold of as well as obtain responseWebRequest demand = WebRequest.Create(get.AbsoluteUri + args); request.Method="OBTAIN"; Stream stream = request.GetRequestStream();//

*

*

Don"t obtain the demand stream, rather just. Obtain demands wear"t normally have bodies(despite the fact that it"s not practically forbidden by HTTP) as well as WebRequest doesn"t assistance it - however that"s what calling GetRequestStream is for, offering body information for the request.Given that you"

re attempting to review from the stream, it seeks to me like you really wish to obtain the reaction as well as review the action stream from that:

WebRequest demand = WebRequest.Create(get.AbsoluteUri + args); request.Method="OBTAIN"; making use of (WebResponse action = request.GetResponse())

*

*

**

I had the comparable concern making use of Flurl.Http: Flurl.Http.FlurlHttpException: Call fallen short. Can not send out a content-body with this verb-type. Obtain http://******:8301/api/v1/agents/****-- > System.Net.ProtocolViolationException: Can not send out a content-body with this verb-type. The trouble was I used.WithHeader("Content-Type ","application/json")when producing IFlurlRequest. Due to the fact that you didn"t define the Header. I"ve included an extensive instance: var demand=(HttpWebRequest)WebRequest.Create (strServer+ strURL.Split

("&" ). ToString()); Header(ref demand, p_Method); As well as the approach Header: exclusive void Header(ref HttpWebRequest p_request, string p_Method)4.0(suitable; MSIE 6.0; Windows CE) "; p_request. Host = strServer.Split("