Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Specs for simple reference</h2> <p>I have always appreciated <a href="http://www.jmarshall.com/easy/http/" rel="nofollow">HTTP Made Really Easy</a> as a starting point. It's small, concise and friendly. </p> <p>Often you can get enough implementation details (or at least enough understanding) from this guide's simple style to suffice your need. It has worked for me many times. There is a section on <a href="http://www.jmarshall.com/easy/http/#postmethod" rel="nofollow">POST</a>. The guide builds cumulatively. </p> <p>Additionally it links to proper specifications and fuller resources should you need to reference them and get into more detail.</p> <h2>.NET Supporting Classes</h2> <p>Fortunately the .NET Framework Class Library contains higher level classes that can simplify your life. Look into the MSDN documentation and examples about <a href="http://msdn.microsoft.com/en-us/library/system.net.webclient.aspx" rel="nofollow">System.Net.WebClient</a> (doesn't lend itself as well to POST, favours GET for quick usage methods). Consider the more flexible <a href="http://msdn.microsoft.com/en-us/library/system.web.httprequest.aspx" rel="nofollow">System.Web.HttpRequest</a> and <a href="http://msdn.microsoft.com/en-us/library/system.web.httpresponse.aspx" rel="nofollow">System.Web.HttpResponse</a> counterpart classes.</p> <h2>Example using C#</h2> <p>This code sample shows the concept of posting binary data to a stream. </p> <p>This method is called like:</p> <pre><code>PostMyData(Stream_instance, "http://url_to_post_to"); </code></pre> <p>Namespaces involved are:</p> <pre><code>using System.IO; using System.Net; </code></pre> <p>The custom method would look something like the following.<br> <strong>Note: Concept taken from <a href="http://msdn.microsoft.com/en-us/library/d4cek6cc.aspx" rel="nofollow">MSDN sample code here</a>.</strong></p> <p>Although I use MIME type <code>application/octet-stream</code> for generic binary data, you can use any well known type from <a href="http://en.wikipedia.org/wiki/Internet_media_type" rel="nofollow">this list of mime types</a> to target the kind of binary data you are sending.</p> <pre><code>public int PostMyData(Stream binaryData, string postToUrl) { // make http request var request = (HttpWebRequest)WebRequest.Create(postToUrl); request.Method = "POST"; request.ContentType = "application/octet-stream"; // binary data: // data (bytes) that will be posted in body of request var streamOut = request.GetRequestStream(); binaryData.CopyTo(streamOut); // post and get response using (var response = (HttpWebResponse)request.GetResponse()) { var code = response.StatusCode; return (int)code; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload