tags:

views:

27

answers:

1

I have a winform application to compress and move some files. When I try to access a path on my desktop, I get an unauthorisedaccess exception. I am running visual studio as administrator (says that in the program bar) and I am a full admin on my machine (can access other accounts, etc).

How can I acess this path (folder)? One of the problems I have is the folder keeps setting itself to readonly.

Thanks

A: 

The readonly flag can be cleared by anyone with write access. If that is all then you will just need to set file attributes. However if the files ACL is blocking you (and it is easy to create an ACL that does not allow administrators) your options are more limited.

Start by finding out why the file keeps being set to read only, because if something else is updating the file you will have to coordinate with that other process otherwise all sorts of problems are likely to occur.

Best tool to see what is happening to a file is Process Monitor from SysInternals.

Richard