views:

56

answers:

0

I have a webpage http://www.example_page.com. When entering this page I login using the following credentials

username: a password: a

now on this page there is a web form with an upload formular which uploads the file I enter by post method when I press the ok button.

Now I want to realize this in c# with the following code

WebClient web = new WebClient();
                web.Credentials = new NetworkCredential("a", "a");
                byte[] responseArray = web.UploadFile("http://www.example_page.com", "my_file.csv");

after the web.UploadFile(...)-Command the program crashes with the following exception

The underlying connection was closed: The connection was closed unexpectedly

Any Ideas what I have done wrong?