Click here to Skip to main content
15,921,793 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm getting an Invalid username and password when trying to copy documents to a network share on my LAN. i dont know where to provide the credentials in the command System.IO.File.Copy() cus the machine i am trying to copy the file to is password protected.

What I have tried:

I have tried the System.IO.File.Copy() command.
Posted
Updated 30-Sep-19 2:15am

1 solution

I just googled "C# file.copy password share" and the first result seems to have your answer:
.net - copy files with authentication in c# - Stack Overflow[^]

The second result has a simple impersonator class you could use: c# - File.Copy() to file server with network Credential - Stack Overflow[^]
 
Share this answer
 
Comments
whatsapp myfriend 30-Sep-19 10:33am    
I'm programming in vb.net
ZurdoDev 30-Sep-19 10:50am    
That's OK. You can convert it to C#. You'll find very few vb.net examples so in the future I would suggest you do google searches for c#.

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