M
martin lanny
My application should periodically connect to multiple network drives to
see if the certain files were created.
I would do this to retrieve the list of files in UNC path //server1/backup/:
----------------------------------
Folder = "//server1/backup/"
Dim listoffiles As New List(Of System.IO.FileInfo)
listoffiles.AddRange(New System.IO.DirectoryInfo(Folder).GetFiles())
----------------------------------
This doesn't work though, because network drive expects network
credentials to be passed.
If I opened the same path (//server1/backup/) in windows explorer, it
would ask me for name and password, but the code above doesn't do any of
that, it just tells me that the drive doesn't exist.
Is there any way to pass network credentials programmatically?
I spent 3 days searching all over the Internet trying to find an answer,
but it seems dot net simply doesn't have any other option than mapping
the drive. I tried 3-4 of those mapping solutions, but neither worked
reliably.
All I want is to access network path (unc) using network credentials, if
there is no way to do so in dot net it would really be a sad discovery.
Joe
see if the certain files were created.
I would do this to retrieve the list of files in UNC path //server1/backup/:
----------------------------------
Folder = "//server1/backup/"
Dim listoffiles As New List(Of System.IO.FileInfo)
listoffiles.AddRange(New System.IO.DirectoryInfo(Folder).GetFiles())
----------------------------------
This doesn't work though, because network drive expects network
credentials to be passed.
If I opened the same path (//server1/backup/) in windows explorer, it
would ask me for name and password, but the code above doesn't do any of
that, it just tells me that the drive doesn't exist.
Is there any way to pass network credentials programmatically?
I spent 3 days searching all over the Internet trying to find an answer,
but it seems dot net simply doesn't have any other option than mapping
the drive. I tried 3-4 of those mapping solutions, but neither worked
reliably.
All I want is to access network path (unc) using network credentials, if
there is no way to do so in dot net it would really be a sad discovery.
Joe