• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1021
  • Last Modified:

How can I post data using HttpWebRequest?

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
Host: hostedconnect.m5net.com
Connection: keep-alive
Content-Type: text/plain
Transfer-Encoding: chunked
0
nyphalanx
Asked:
nyphalanx
  • 3
1 Solution
 
jjardineCommented:
This shows how to do it..  http://msdn.microsoft.com/en-us/library/debx8sh9.aspx

A little broken up but shows how to add the content.
0
 
nyphalanxAuthor Commented:
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
Host: hostedconnect.m5net.com
Connection: keep-alive
Content-Type: text/plain
Transfer-Encoding: chunked
0
 
nyphalanxAuthor Commented:
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.
0
 
nyphalanxAuthor Commented:
You answered my question, it was part of a larger issue we were having but you answered the specific question I asked.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now