I try to copy a file to a mapped network drive, but I always get the message "Could not find a part of the path ...". I tried different mapped network drives, so I could exclude credential problems (it neither works with a drive connexcted with different credentials nor with my normal user)
try
{
fi.CopyTo(SystemReg.TargetPath + fi.Name);
}
catch (Exception e)
{
SystemReg.Log.AppendLine("Copy failed! " + Environment.NewLine + e.Message);
}
SystemReg.TargetPath is read from an XML file. If I use a local path like D:\temp\
it works perfectly, but e.g. X:\temp\
with X as a mapped drive it fails.
I also tried to run my program in a batch file with "net use..." before calling my program, it also fails.
You shoud use computer address instead of drive name.
For example, if your computer's address is 192.168.0.200
which keeps shared folder temp\
then your full path is \\192.168.0.200\temp\