Uploading a document using http post

  • Thread starter Thread starter neoret
  • Start date Start date
N

neoret

Hi there.

I need to perform an upload of a document using HTTP post. This has to
be done from my windows form using C#.

My challenge is:
1: To send - the word document
2: To attach several variables to the same request
3: To handle the response.
4: To authenticate my request by adding a username and pasword.

I found out that the webclient isn't complex enough. I guess I have to
use the httpWebrequest.

Thank you in advance for your contribution!!

Neoret
 
Neoret,

If it wasn't for #2, you could actually use WebClient for all of this.

If you are going to use HttpWebRequest, then you will have to handle all
of the uploading code yourself, meaning, you have to write the name/value
pairs, the boundaries, the content length, etc, etc.

All in all, it's quite a task.

I would look at the HTTP specification for how to do this, either that,
or dig through the WebClient class with reflector and find out how they are
doing it for the UploadValues and UploadFile method and do it yourself.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top