This may be an ancient problem.
So, I have a C# application that allows the user to insert images, usually photos, so it can register any problems found on the working site.
When it was being used on a local network, the user could use the OpenFileDialog()
with no problem as the user could use all shortcuts so access their folders.
Now we migrated the application to an AWS server, but the OpenFileDialog()
now allows the user to access all folders in the virtual machine. Not only that, the user can create, edit or delete folders and files, which can be problematic.
As far as I could find, there is no way to restrict the OpenFileDialog window (thanks Microsoft, it has been a problem for over a decade, and it is still not solved), so it needs a workaround.
Problem:
I need a fileDialog
window that looks similar to the OpenFileDialog one, but it should have te following restrictions:
- The user cannot access any directory located outside its own computer;
- The user cannot create, edit or delete folders and files;
If possible, I would like to have the Quick Access menu, so the user can navigate faster.
All users PCs are Windows 7 or later.
The first attempt was obviously the OpenFileDialog.InitialDirectory
one:
OpenFileDialog.InitialDirectory = @"\\tsclient\C\Users\"; = @"\\tsclient\C\Users\"; which is only a change on the initial directory.
But the result was allowing the user to basically do whatever, that was the start of my search.
Validating the selected file does not help much against the create, edit or delete.