Click here to Skip to main content
15,886,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,
i need some help.i want to copy some file to another system which is a network system.all systems are connected through LAN.
when i copy a file to my server system to another system it gives an error(system connot found or connot logon to system.).

my code is

File.Copy(serverPath,_localPath);

i searched a lot on Internet to solve this problem and found a solution.it use WNetAddConnection2 function.but i am unable to implement it in my project.





Thanks in advance,
Posted
Comments
Reiss 8-Aug-11 7:39am    
Are you using the full unc path for the server path, e.g. \\servername\c$\folder
204.sharma 8-Aug-11 8:04am    
yes i have taken.

1 solution

You could import this function, for example using signature from here[^]. But your problem doesn't seem to require that much effort actually; agreed with Reiss' question, have you checked that you are using a valid UNC path value for serverPath?
 
Share this answer
 
v2
Comments
204.sharma 8-Aug-11 8:06am    
what the namespaces i need except system.net
Timberbird 8-Aug-11 8:43am    
You can see an example (including namespaces required) here. I recommend you to ensure there's no other way first, though. For example, is server folder accessible from local machine via Windows Explorer? Does user account under which your code is executed really has write permission on this folder?
204.sharma 9-Aug-11 6:43am    
Thanks,

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