How can I post data using HttpWebRequest?

Posted on 2009-04-02
Last Modified: 2012-05-06
I'm trying to send the following request to a server. How can I do this using C#? The server will be expecting this post, and it will then reply back with some information.

POST /bobl/bobl HTTP/1.1
Connection: keep-alive
Content-Type: text/plain
Transfer-Encoding: chunked
Question by:nyphalanx
  • 3
LVL 14

Accepted Solution

jjardine earned 500 total points
ID: 24056086
This shows how to do it..

A little broken up but shows how to add the content.

Author Comment

ID: 24060193
Is there any way to view the header that is being sent? I want to verify that something like the header below is actually being sent.

POST /bobl/bobl HTTP/1.1
Connection: keep-alive
Content-Type: text/plain
Transfer-Encoding: chunked

Author Comment

ID: 24060721
Nevermind, I figure out why our implementation wasn't working. Everytime we went to read the response it was always blank, we had to set HttpWebRequest.AllowReadStreamBuffering  to false.

Author Closing Comment

ID: 31566090
You answered my question, it was part of a larger issue we were having but you answered the specific question I asked.

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Get String split 5 46
IO.FileSystemWatcher dies when used in Powershell 1 44
Runtime Error 2 27
Error in script 11 43
Introduction This warning has to be one of the most commonly issued warnings in the history of PHP.  The article explains why this warning arises and what to do to mitigate the problem. How this Happens HTTP headers include many different kinds…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
A short film showing how OnPage and Connectwise integration works.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now