We currently have a couple of elements with file handling in one master directory and we are trying to establish a remote location since there will be multiple DMA's on release. We are currently using the ImpersonatedUser class with Interactive privileges with the Microsoft Security namespace and WindowsIdentity class.
We are still encountering strange AccessToPathIsDenied exceptions and AccessDenied exceptions when trying to read files. Also, some elements (running the same protocol) seem to have different privileges as some are able to read and write, others only read, and others none at all.
Another preference would be a method using a System account as opposed to a User account since the password will need to be reset every couple of months and that may be cumbersome for the client to update the passwords on so many elements.
So in short, is there a better way besides the ImpersonatedUser with heightened privileges and able to use a system account to access a remote directory?
I have a couple questions for you:
1) Are you sure the current implementation with ImpersonatedUser is done correctly? As it seems weird that it behaves differently for other elements from the same protocol. I guess you are pointing to the same shared folder with the same impersonated User/PW configured?
2) I also see your tag on this question indicates "C++". Are you using C++ code accessed via a DLL in the QAction? Or are you coding directly in your QAction in C# and maybe the tag was a typo?
If you could maybe send the protocol over by PM, I can have a quick look at it.