Dinesh
Dinesh

Reputation: 11

Is it possible to send content body with get request in c# using HTTP 1.1

Is it possible to send content body with get request in c# using HTTP 1.1(RFC 2616). I also Need How to implement this in c#. I am getting protocol violation exception:can't send content body with this verb type.

Upvotes: 1

Views: 129

Answers (1)

David
David

Reputation: 218837

Not really, and it has nothing to do with C# or ASP.NET specifically.

Technically you may be able to include a request body in a GET request. If certain objects in .NET don't allow you, you can always craft such a request manually and work around those objects. However, that effort isn't going to get you very far, because GET requests aren't supposed to have request body content. So the server is most likely going to ignore it anyway, if it's not dropped by something in between.

The bottom line is, GET requests don't have a request body. Whatever you're trying to accomplish should be accomplished by some other means.

Upvotes: 1

Related Questions