Interview Question in Sharepoint Documents


 

Question :: cSharp Windows App help

Im making a windows application to upload docs to a sharepoint server, and i have mapped the server as a network drive. Now when i try and access it through my application, i get an error...
'Access to the path x:\ is denied'

here is some sample code for what im doing

WebClient client = new WebClient();
client.Credentials = new NetworkCredential("username", "password");

try
{
client.UploadFile(@"x:\Shared Documents",
@"c:\Users\Alex\Documents\MyTest.txt");
label1.Visible = true;
}
catch (Exception ex)
{
MessageBox.Show(this, "Error: " + ex.Message);
}