I have the following code that sends a file to an ASP.net page:
using (var Client = new WebClient()) Client.UploadFile("http://localhost:1625/Upload.aspx", @"TestFile.csv");
On the server page, I read the contents of the request:
var Contents = new byte[Request.InputStream.Length]; Request.InputStream.Read(Contents, 0, (int)Request.InputStream.Length);
This is what I get in the content:
-----------------------8cf2bdc76fe2b40 Content-Disposition: form-data; name="file"; filename="TestFile.csv" Content-Type: application/octet-stream 1;Test 1 2;Test 2 3;Test 3 4;Test 4 5;Test 5 -----------------------8cf2bdc76fe2b40--
The actual contents of the file are just 1;Test 1 ... 5;Test 5 . My question is how to get only the contents of the file, and not the entire request with headers?
source share