2014-02-18 144 views
0

我有一個可以正常工作的VB.NET應用程序,但是當我需要保存到文件時,由於我的應用程序未以管理員身份運行,因此我得到拒絕的文件夾訪問權限。以管理員身份運行VB.NET程序應用程序

我已經嘗試了所有在NET上,但我的應用程序仍然不會以管理員身份運行。

我所做的事情:

  • 添加清單文件,以我的應用程序與<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
  • 創建一個安裝程序中添加RUNASADMIN進入註冊表

,但無濟於事。基本上我的應用程序需要以某種方式設置保存到程序文件夾中的本地文件。

關於我如何解決這個問題的任何想法?

<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> 
<security> 
    <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> 
    <!-- UAC Manifest Options 
     If you want to change the Windows User Account Control level replace the 
     requestedExecutionLevel node with one of the following. 

    <requestedExecutionLevel level="asInvoker" uiAccess="false" /> 
    <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> 
    <requestedExecutionLevel level="highestAvailable" uiAccess="false" /> 

     Specifying requestedExecutionLevel node will disable file and registry virtualization. 
     If you want to utilize File and Registry Virtualization for backward 
     compatibility then delete the requestedExecutionLevel node. 
    --> 
    <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> 
    </requestedPrivileges> 
</security> 

+0

你可以發佈完整的配置文件 – JaredPar

+0

你有沒有在你測試的機器上禁用UAC?你有沒有得到UAC提示? – Gray

+0

重點需要在文件夾上。所以我的VB應用程序保存到XML文件,除非我以管理員模式運行應用程序,否則我無法保存到文件中。我可以從他們那裏讀到。該文件夾位於Program Files(x86) – CJSoldier

回答

0

試圖嵌入,我需要將XML文件保存到AppData目錄加以保存後原來。這樣UAC不會干涉。

相關問題