Vanessa,
Well, it is more than likely that your user that is copying the files
doesn't have access, since it is the program files directory. They have to
be given access, and even then, they probably have to validate the action
through UAC on Vista (unless it is disabled).
Basically, there is nothing you can (or should) do in code if your user
doesn't have rights. You basically should catch the error, and inform the
user that they don't have the appropriate permissions.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Vanessa" <Va*****@discussions.microsoft.comwrote in message
news:F0**********************************@microsof t.com...
Hi all!
I developed a self updating application (Windows Forms). When there is a
new
version, I have to copy it to the directory that it was previously
installed.
If the application is installed in another directory outside "\Program
Files", it is working well.
The problem is that if the application is installed in "\Program
Files\Product", where I have an UnauthorizedAccessException when I start
copying the new version (I am using File.Copy()). Is there a way to copy
files to this directory?
Thank you,
Vanessa