Ok, I'm writing a simple helper class for sending HttpWebRequests programmatically w/ the ability to optionally include GET or POST parameters. I thought I had it all done but I've run into a few problems...
First with sending GET params (I'm just cutting my code in snippets from my class so it may look like it isn't complete but that's because it isn't, at least not here):
Now when I try and get the response w/
it throws the error "Cannot send a content-body with this verb-type". Any help here?
Now for the POST params I use the same code as above except I set the
to
and here's the error I get for that... "The remove server returned an error: (405) Method Not Allowed". The error is slightly different depending on the URL I'm attempting to POST to but that's basically what they all say.
Any help would be greatly appreciated
Thank you!
First with sending GET params (I'm just cutting my code in snippets from my class so it may look like it isn't complete but that's because it isn't, at least not here):
Code:
this.request = (HttpWebRequest)WebRequest.Create(new Uri(url));
this.request.Method = "GET";
StreamWriter writer = new StreamWriter(this.request.GetRequestStream());
writer.Write("param1=value1¶m2=value2");
writer.Close();
Now when I try and get the response w/
Code:
this.request.GetResponseStream();
Now for the POST params I use the same code as above except I set the
Code:
this.request.Method="GET";
Code:
this.request.Method="POST";
Any help would be greatly appreciated

