I need to block access to network based directories. However by using tools like "mklink" users can create mapped directories which appear like local directories. I use a .net based code to get the UNC paths of the directories to identify network folders. But this does not work for mapped folders. Is there any information in DirectoryInfo
class which I can use?
Disclaimer: I haven't tested symlinks on a network drive - don't have permission to create one. I'll try at home later and update my answer. But I can tell you that on a local disk:
Attributes
property will have the Directory
bit set. Directory
and ReparsePoint
bits are set.So try checking the ReparsePoint
bit.
UPDATE:
A network folder has only the Directory
bit set.
There seems to be some oddness about the root directory on a volume -- whether it's a local or network drive -- it also has the Hidden
and System
bits set. Not sure why.
But it does seem that network folders behave just like local folders (which makes sense).