Restrict the user to a specific directory in OpenFileDialog

Is there any way to limit the user to selecting files only from a specific directory in C #? You cannot allow viewing other folders.

+4
source share
2 answers

Not possible with standard .NET shells. Reject the path using the FileOk event.

If you can count on your program running in Vista and later, you might consider using the CommonFileDialog class in Code Code for the Windows API. It has a FolderChanging event that can be undone.

+6
source

You cannot do this from the application. However, this can be done using user management in the OS.

+2
source

Source: https://habr.com/ru/post/1333636/


All Articles