Represents a network connection along with authentication to a network share.
Based on Daniel Hilgarth's answer from Stack Overflow.
using(new NetworkConnection(_directoryPath, new NetworkCredential(_userName, _password)))
{
File.Copy(localPath, _directoryPath);
}