ASPNET - Cannot send a content-body with this verb-type GET

ASPNET - Cannot send a content-body with this verb-type GET



I am trying a send a GET request with a content-body, I have the following error :



Cannot send a content-body with this verb-type



I use HttpWebRequest.
A Exception start when the method Http.GetRequestStream() is requested.



I read another related thread on Stackoverflow but I don't read good answer.
I can't change a verb because i use a service web owner.



Can you help me ?



Best Regards



Arnaud






Please, can you send a sample of code. It's difficult to help you without it

– OrcusZ
Sep 18 '18 at 12:13






I assume this is the other thread you mentioned stackoverflow.com/questions/253549/… , as the answers to the question say you can't set a body on a GET request. If the endpoint you are calling really expects a body on GET, then you need to change the endpoint.

– andynormancx
Sep 18 '18 at 12:21






You have to use a POST rather than a GET. Parameters needed for a GET are usually passed in the query string, or as a header, but this should not be used for putting entire amounts of data. You're essentially POSTing information to the API which it should then store

– ColinM
Sep 18 '18 at 12:21



POST


GET


GET






Possible duplicate of How do I use HttpWebRequest with GET method

– andynormancx
Sep 18 '18 at 12:22






One thing you should check is whether the endpoint you are calling supports the X-HTTP-Method-Override header. If that was the case you could make a POST request, with a body, but tell it to treat it as a GET. It is unlikely however that an endpoint expecting a body on a GET will have that sort of support

– andynormancx
Sep 18 '18 at 12:27



X-HTTP-Method-Override header


POST


GET


GET




0



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

How do I collapse sections of code in Visual Studio Code for Windows?

ャフサォクコ ケウ,コ,ワ メ,ロスョノ゙,クネ,フムカヤヲニ,エコ゚ツ ウイオン゙ケワサネォキモュキォウイノンコチ゚メヌナイゥフュ,カヒウネェ ネ,ホノケ,ムュキ ッボーミュハ,チ ツス ィ メウイマヤ,゙ウチ ヅ ロ,ォジヌェ ャヌット ェ,マャ,チナエヒネソキツテ トホヲヲミーァ