Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3595950
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:55:12+00:00 2026-05-18T19:55:12+00:00

I am using C# for my project, can anyone tell me what is a

  • 0

I am using C# for my project, can anyone tell me what is a standered structure of a HTTP POST Requset. How to attach POST data like a file in the Request from code.

Simply i want to create a POST request from my code itself, with diffrent items to be posted available.

I have checked Ietf’s RFC for http POST but its too long….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T19:55:13+00:00Added an answer on May 18, 2026 at 7:55 pm

    Specs for simple reference

    I have always appreciated HTTP Made Really Easy as a starting point. It’s small, concise and friendly.

    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 POST. The guide builds cumulatively.

    Additionally it links to proper specifications and fuller resources should you need to reference them and get into more detail.

    .NET Supporting Classes

    Fortunately the .NET Framework Class Library contains higher level classes that can simplify your life. Look into the MSDN documentation and examples about System.Net.WebClient (doesn’t lend itself as well to POST, favours GET for quick usage methods). Consider the more flexible System.Web.HttpRequest and System.Web.HttpResponse counterpart classes.

    Example using C#

    This code sample shows the concept of posting binary data to a stream.

    This method is called like:

    PostMyData(Stream_instance, "http://url_to_post_to");
    

    Namespaces involved are:

    using System.IO;
    using System.Net;
    

    The custom method would look something like the following.
    Note: Concept taken from MSDN sample code here.

    Although I use MIME type application/octet-stream for generic binary data, you can use any well known type from this list of mime types to target the kind of binary data you are sending.

    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;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using C# for my project, can anyone tell me what is a
Can anyone tell me how to zipalign my .apk file with using eclipse. I
Can i create 64-bit setup.exe file using InstallScript project in InstallShield 2009? Documentation is
i posted some data using tinymce (in a symfony project).while retrieving back how can
I am using nutch 1.4 to implement a focused crawler. Can anyone tell me
Can anyone tell me what the need/advantage is to using a web service with
I have a legacy project using Rails 2.3.5 but I can't find with which
I'm about to star an OSGI project using netbeans 6.8 and felix 2.0.4; can
In Delphi 2009, how can I build a project using command line. I tried
I'm creating a simple CMS using kohana3 in which user can add project to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.