Asked by:

Reading a file/folder permission on network using VB.net

Question

Can anyone teach me on how you can allow vb.net to access a file/folder within a domain group and retrieves it permission setting to determine if the user have access or denied access to a certain folder?

To check whether the user has the access to a certain folder, a simple way is to create a new file with System.IO.File within a try/catch statement, if no exceptions pop up, that means the user does have the permission.

I try to map to the network drives and i am able to read the number of folders in the drives and access right for FULL CONTROL ( READ , write etc. ) is given to me and in fact "everyone in the same domain group that i am in. However i encounter
the following code error where

FileOpen(1, ReadString, OpenMode.Binary) --> It prompts that access to the path of \\xxxxxxxxx\folder\ is denied.

I am able to retrieve all the folders but when it starts
to open the binary files it start to give the runtime exception of access denied. Can
anyone help me in detailed explaination?