简体   繁体   中英

How to restrict a user not to open a folder using vb.net

Is it possible to restrict a user from opening a sub folder like "permission denied" message should display while trying to open the folder. If yes, help me to solve this using vb.net in winform as well as using vb.net in asp.net

Rather than try to restrict access to a folder, it may be easier to add your files as embedded resources . That way they will be part of your executable and the users won't be able to delete them.

将问题二进制文件放到子文件夹中,并使该文件对管理员以外的任何用户均只读,这不是编程问题,而是管理问题。

Following the comments, you have an interesting set of constraints.

For the web this is relatively straightforward and you can restrict user access to application/data files in any number of ways - this is (or ought to be) inherent in web servers/applications (its certainly baked into asp.net).

For a desktop application however its rather more interesting and it depends on how the application is to be installed/run - if the user has admin rights on the machine then there's very little you can do to stop them manipulating files. If they don't then you need an admin to deploy the application and you have a different set of interesting problems.

As you're looking for a solution to work on both platforms then I'd do as @Andy suggests the best solution is probably therefore to make the questions embedded resources - this won't necessarily stop a user deleting the file but it will make manipulating the content much harder, you can add a fingerprint (MD5 for example) and encryption into the mix too. If you want to be able to have different question sets you can just embed them into a separate .dll and there are various options for picking up the .dlls at runtime.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM