A UnauthorizedAccessException
is thrown when there is a permissions error accessing the file on disk. That is an error at the operating system level such as a normal user trying to overwrite an operating system file (like kernel32.dll).
A SecurityException
is thrown if there is a security violation at the CLR level. For example if you are running as a low access ClickOnce application and attempt to read / write to a place in the file system forbidden by the CLR security settings in the process.