c# - ProtocolViolationException when doing a WebRequest with GET -


i'm trying gather data public api windows phone app.

private void gatherposts() {     string url = baseurl + "?after=" + lastpostid + "&gifs=1";     httpwebrequest request = webrequest.create(url) httpwebrequest;     request.contenttype = "text/json";     request.method = "get";      asynccallback callback = new asynccallback(postrequestfinished);     request.begingetresponse(callback, request); }  private void postrequestfinished(iasyncresult result) {     httpwebrequest request = (httpwebrequest)result.asyncstate;     httpwebresponse response = (httpwebresponse)request.endgetresponse(result); } 

but keep getting protocolviolationexception on last line of callback method message a request method cannot have request body.. read it's because i'm trying send data, forbidden protocol, don't see i'm doing it, i.e. how avoid it.

it's contenttype makes think there request body, exception.

you want set accept-encoding instead.


Comments

Popular posts from this blog

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

ruby on rails - Authlogic - how to make a registration and don't log in the new account? -