Dear Shital,
Code to upload a file on Server using WebClient method:
System.Net.WebClient webClient = new System.Net.WebClient();
string sourceFilePath = @"D:\MyDocuments\DataFile.xml" ;
string webAddress = "http://www.YourDomainName.com/ClientFiles/";
string destinationFilePath= webAddress + "DataFile.xml";
webClient.Credentials = new System.Net.NetworkCredential("username", "password", "domain");
webClient.UploadFile(destinationFilePath, "PUT", sourceFilePath);
webClient.Dispose();
Code to download a file from Server using WebClient method:
System.Net.WebClient webClient = new System.Net.WebClient();
string webAddress = "http://www.YourDomainName.com/ClientFiles/";
string sourceFilePath = webAddress + "DataFile.xml";
string destinationFilePath = @"D:\MyDocuments\DataFile.xml";
webClient.Credentials = new System.Net.NetworkCredential("username", "password", "domain");
webClient.DownloadFile(sourceFilePath, destinationFilePath);
webClient.Dispose();
Link :
http://chiragvidani.blogspot.in/2011/10/how-to-uploaddownload-file-tofrom.html
http://msdn.microsoft.com/en-us/library/ez801hhe.aspx
Happy Coding
If it helps you or directs U towards the solution,
MARK IT AS ANSWER Shitalr, if this helps please login to Mark As Answer. | Alert Moderator