Solved

How can I post data using HttpWebRequest?

Posted on 2009-04-02
4
1,005 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikipedia.org/wiki/PHP  Very powerful.  But a…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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