In my application i am uploading files to sharepoint 2007. I am using
using (WebClient webClient = new WebClient())
{
webClient.Credentials = new NetworkCredential(userName, password);
webClient.Headers.Add("Content-Type", "application/x-vermeer-urlencoded");
webClient.Headers.Add("X-Vermeer-Content-Type", "application/x-vermeer-urlencoded");
String result = Encoding.UTF8.GetString(webClient.UploadData(webUrl + "/_vti_bin/_vti_aut/author.dll","POST", data.ToArray()));
}
the code is running successfully..but for some files it throws exception
The underlying connection was closed:
The connection was closed
unexpectedly. at
System.Net.WebClient.UploadDataInternal(Uri
address, String method, Byte[] data,
WebRequest& request) at
System.Net.WebClient.UploadData(Uri
address, String method, Byte[] data)
at
System.Net.WebClient.UploadData(String
address, String method, Byte[] data)
Any Ideas what I have done wrong?
I am using VS-2008 2.0