Solved

How can I post data using HttpWebRequest?

Posted on 2009-04-02
4
1,006 Views
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
Host: hostedconnect.m5net.com
Connection: keep-alive
Content-Type: text/plain
Transfer-Encoding: chunked
0
Comment
Question by:nyphalanx
  • 3
4 Comments
 
LVL 14

Accepted Solution

by:
jjardine earned 500 total points
ID: 24056086
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
 

Author Comment

by:nyphalanx
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
Host: hostedconnect.m5net.com
Connection: keep-alive
Content-Type: text/plain
Transfer-Encoding: chunked
0
 

Author Comment

by:nyphalanx
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.
0
 

Author Closing Comment

by:nyphalanx
ID: 31566090
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

808 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