UnauthorizedAccessException in debug mode only?

A

Andy

Hi,

Using VS2008, .Net 3.5.

I have a File.Copy which is copying files to a unc path. The copying
is done by a normal Wpf application. Suddenly, trying to copy the
web.config to the unc path fails. So does File.Delete, although I
have no problems deleting the file via Explorer. Even more curious,
if I switch the build configuration to Release, it works fine. So it
only seems to happen in Debug mode.

Any ideas? Just want to restate, this is a Wpf application NOT
running under Asp.Net or a service account; it's running as me with my
WindowsPrincipal set on the executing thread.

Thanks
Andy
 
A

Andy

Ok, I found the problem.. the target file had the ReadOnly flag set.
Code that unsets it prior to copying solves the issue.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top