I'm building a bit of software that will be accessing files that are hosted on MS Share point. When I map a network drive (Z:\....) and access the file using this path - it all works fine. Problem is when I try to put the network path (\\Cintranet\....) it falis with an exception of 'Logon Failed'
My guess is that when i'm using the network drive Windows automatically sends a usrname and password to gain access... Question is how do I retrieve this information programatically and send this to the Server to gain access?
Any help would be great!!
//This one fails with 'Logon failed' exception
FileInfo theSourceFile = new FileInfo(@"\\\\cintranet\\Operations\\Cintra HR Implementation\\ClientList.ini");
//This one works but only on my computer as other people will not have this drive mapping
FileInfo theSourceFile = new FileInfo(@"Z:\Cintra HR Implementation\\ClientList.ini");
StreamReader stream = theSourceFile.OpenText();