FileIOPermission Problem
-
Good Evening, currently I am doing a small program which copies a file from one folder to another folder. The destination folder is the "Fonts" folder which holds all fonts of my system. Currently my code looks like this:
FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Write, "C:\\Windows\\Fonts\\");
f2.AddPathList(FileIOPermissionAccess.Read , origin);try { System.IO.File.Copy(origin, destination); } catch (UnauthorizedAccessException ex) { MessageBox.Show(ex.ToString()); }
When I start debugging, the debugger tells me that I dont have permission for C:\Windows\Fonts\"filename". Which confuses me a bit since I thought I already got write permission to "C:\Windows\Fonts\". What am i doing wrong? P.S.: I am using Windows Vista SP1 64-Bit Thanks for your help and advices
-
Good Evening, currently I am doing a small program which copies a file from one folder to another folder. The destination folder is the "Fonts" folder which holds all fonts of my system. Currently my code looks like this:
FileIOPermission f2 = new FileIOPermission(FileIOPermissionAccess.Write, "C:\\Windows\\Fonts\\");
f2.AddPathList(FileIOPermissionAccess.Read , origin);try { System.IO.File.Copy(origin, destination); } catch (UnauthorizedAccessException ex) { MessageBox.Show(ex.ToString()); }
When I start debugging, the debugger tells me that I dont have permission for C:\Windows\Fonts\"filename". Which confuses me a bit since I thought I already got write permission to "C:\Windows\Fonts\". What am i doing wrong? P.S.: I am using Windows Vista SP1 64-Bit Thanks for your help and advices
Can someone give me some help on this please, since i dont know what i am doing wrong? I used a messagebox to have a quick look at the permmission i requested and it says i asked for write permission for C:\Windows\Fonts and read permission for the folder in "origin". Is there something else I have to do?