Click here to Skip to main content
15,908,437 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi All

I am trying to copy files and folders from my local system to server but i ma getting exception like
C#
The network name cannot be found


what may be the reason? if nay other approach to send file from local to server please suggest me link

C#
 var fileName = "224_TestCases.xlsx";
                var local = Path.Combine(@"E:\ExcelModel\ExcelModel\TestPlan", fileName);
                var remote = Path.Combine(@"\\serverip\\c$\\", fileName);
                File.Copy(local, remote);

i am getting execption here  File.Copy(local, remote);



thanku

What I have tried:

var fileName = "224_TestCases.xlsx";
var local = Path.Combine(@"E:\ExcelModel\ExcelModel\TestPlan", fileName);
var remote = Path.Combine(@"\\serverip\\c$\\", fileName);
File.Copy(local, remote);

i am getting execption here File.Copy(local, remote);
Posted
Updated 4-Oct-16 20:26pm
Comments
[no name] 5-Oct-16 6:31am    
And make sure you are using the correct number of \

1 solution

1) Make sure you get the server name or IP address is right e.g. \\192.168.1.2 or \\servername
2) When using the admin shares like c$ make sure the running application has the right credentials when running.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900