With respect to the question: Is it possible to avoid permission related exceptions while attempting to write to the disk?
In short, the answer is: yes this can be accomplished through the use of impersonation.
SOLUTION NOTES
IMPERSONATION & PERMISSIONS
Impersonation is the ability of a thread to execute using a different security information than the process that owns the thread. Typically, a thread in a server application impersonates a client. This allows the server thread to act on behalf of that client to access objects on the server or validate access to the client's own objects. [SOURCE: A Complete Impersonation Demo]
As highlighted by Aasmund Eldhuset, running as an administrator does not guarantee that you will have the appropriate permissions to access the file system.
As a sanity check, you could create a simple application to ensure that everything is working as expected.
- Create a simple WinForms application that will write a text file to disk using impersonation.
- Create a test environment with folders/directories and different user permissions
- Verify that everything works:
- Run the test application and have it write to a directory where you DO have permission.
- Run the test application and have it write to a directory where you **DO NOT* have the appropriate permissions.
APPLICATION DESIGN
I suggest that you take user feedback with a grain of salt as it is not uncommon for users to provide inaccurate or incomplete descriptions of problems they are encountering.
In your scenario, I would have your application attempt to write to the directory/folder in question when the application starts. If the write fails, then you can record relevant information (e.g. the name of the user that is executing the write operation) to an event log (e.g. text file) for later review.
ADDITIONAL READING