I want to send a normal text file from my VisualStudio C# Windows Forms Application via "Post" to an Url with a WebClient. my code:
using(WebClient w = new WebClient())
{
w.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string HtmlResult = w.UploadString(@"http://xxx/api/test", "Post", @"C:\Temp\T.txt");
}
This is what I found so far. When I run this code the post method in my web project gets hit but the param is null (which is understandable since its data type is a string but it is also null when I change the file address to a simple string like "test").
So my real problem is that I can´t send my text data to my URL.