Check user permission on drives
-
I have a file explorer feature for a windows application. I need to show the computer drives that are only permitted to user. By using driveinfo we get all logicaldrives,but how to check whether which drive is permitted for user ? When i run this application in Windows server 2008 i should be able to view only the permitted drives in fileexplorer. Using System.Security.Principal.WindowsIdentity.GetCurrent() i can get the current loggedin user.
-
I have a file explorer feature for a windows application. I need to show the computer drives that are only permitted to user. By using driveinfo we get all logicaldrives,but how to check whether which drive is permitted for user ? When i run this application in Windows server 2008 i should be able to view only the permitted drives in fileexplorer. Using System.Security.Principal.WindowsIdentity.GetCurrent() i can get the current loggedin user.
Considering all drives are always visible to every user by default, your request doesn't make much sense. If policies are preventing a user from seeing a drive, the code that enumerates drives won't show the letters that the user cannot see anyway, without you having to check permissions.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak