Solved

How can I post data using HttpWebRequest?

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Linq help 1 16
.NET Error 7 42
Check my code out(2) 1 35
IO.FileSystemWatcher dies when used in Powershell 1 28
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
A Change in PHP Behavior with Session Write Short Circuit (http://php.net/manual/en/book.session.php#116217) (Winter 2014)** With the release of PHP 5.6 the session handler changed in a way that many think should be considered a bug.  See the note …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 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

12 Experts available now in Live!

Get 1:1 Help Now