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

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

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -