2

I'm trying to use C# and the .NET Framework 4.0 to make a program which can upload a local file along with some additional request parameters through an HTTP POST request.

Basically it would result in a request like this:

http:\\example.com\upload.html?file=<filedata goes here>&private=1&type=archive

It should be a POST request though not a GET request.

Does ASP.NET 4.0 provide any means of doing this?

Edit for clarity: I want to upload a local file to a server with my program, my program will not run on the server.

7

1 Answer 1

5

Yes, you can use the System.Net.HttpWebRequest class. Set the Method property to "POST" to use POST rather than GET. This question seems to have it covered.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.