المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : FileIOPermission Problem



C# Programming
05-26-2009, 12:41 AM
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