私のWPF MVVMアプリケーションでは、変更するXMLファイルがあります。 Visual Studioで正常に動作しています。 しかし、インストールされているアプリケーションの実行中にエラーが表示されます。私はWPFのファイルへの書き込み権限のプログラム追加
// current security settings.
FileSecurity fSecurity = File.GetAccessControl(FilePath);
// Add the FileSystemAccessRule to the security settings.
string rr = WindowsIdentity.GetCurrent().Name;
fSecurity.AddAccessRule(new FileSystemAccessRule(WindowsIdentity.GetCurrent().Name,
FileSystemRights.FullControl, AccessControlType.Allow));
// Set the new access settings.
File.SetAccessControl(FilePath, fSecurity);
まだカントは
が見..事前に
おかげで、...問題を解決するため、このコードを使用するどのように私は、コードを通じてアクセス権を設定することができます。..
例外...
System.UnauthorizedAccessException:を実行しようとしました。不正操作。 でSystem.Security.AccessControl.Win32.SetSecurityInfo(ResourceTypeが型、 文字列名、SafeHandleハンドル、SecurityInfosセキュリティ情報、 セキュリティ識別子の所有者、セキュリティ識別子基、GenericAcl SACL、 GenericAcl DACL) System.Security.AccessControl.NativeObjectSecurity.PersistでSystem.Security.AccessControl.NativeObjectSecurity.Persistで System.Security.AccessControl.NativeObjectSecurity.Persist(文字列 名、AccessControlSections includeSections、exceptionContextオブジェクト) (文字列に(文字列 名、SafeHandleは exceptionContextオブジェクト、AccessControlSections includeSectionsハンドル) name、AccessControlSections includesSections)atアクセス権を設定するにはSystem.IO.File.SetAccessControl(文字列のパス、 FileSecurity fileSecurity)でSystem.Security.AccessControl.FileSystemSecurity.Persist(文字列 をフルパス)
あなたが手順を説明plzはまだ問題がexists.Could ... – S007
はい、私は、私は、正確な例外メッセージと質問を更新しました....のWindows7を使用しています。 – S007
上記の作業例を追加しました。 – Munawar