Search code examples
c#.netioexceptiondirectoryinfomscorlib

'The target account name is incorrect'-IOException with DirectoryInfo.GetFiles


I am doing this and this was working before:

var di = new DirectoryInfo("FolderOnSharedDrive");
var files = di.GetFiles("*");

I have now this exception and the only difference I can see is that I have now Windows 10.

Exception thrown: 'System.IO.IOException' in mscorlib.dll
Additional information: The target account name is incorrect.

Solution

  • Problem solved by deregistering the machine completely from the network.