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.
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.