Reputation: 11535
How do I prevent my .net (C#) program from ever writing to disk?
Edit: There's a FileIOPermissionAttribute for anyone curious. This codeproject also shows a way.
Upvotes: 2
Views: 104
Reputation: 1062492
You can use caspol to ensure that the exe is not executed with "full trust", and limit the trust excluding that permission (FileIOPermission
). However, if the exe is not designed and tested to run without full trust, it could completely fail to do anything.
Upvotes: 2
Reputation: 56
You can run it with an account that is not authorized to write to disk.
Upvotes: 2