Click here to Skip to main content
15,904,024 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have developed a software named scanning in VB.NET. Its EXE was running successfully in
Windows XP and in windows 7 but when I test it over windows 8 it gave me the following error :-

System.UnauthorizedAccessException: Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\
PartapScan' is denied at Microsoft.Win32.RegistryKey.Win32Error(Int32 error code,string str) at Microsoft.Win32.RegistryKey.CreateSubKey(string subkey,RegisterKeyPermissionCheck permissionCheck,
RegistrySecurity registrySecurity) at Scanning.ServerSetting.Set_server_in_reg()

Please help....
Posted

Seems like a permission problem to me, try to run your app in with Administrator privileges and see if this still happens. If it doesn't happens anymore, then you know your app needs the Administrator privilege to run (at least this part of the app).
 
Share this answer
 
Comments
ashwani.pandita 30-May-13 5:30am    
Thanks a lot sir, But I didn't get it fully. Please guide me how...
VICK 30-May-13 5:57am    
Just right click on your app icon and click "Run as Administrator"............
Your program to needs administrative privileges but the fact that it ran in Windows 7 without any problems still bothers me.

Well, to make your program run as administrator, you could just right click on the EXE and select "Run as administrator"

Or you could do that directly from your Programming IDE by changing the required privilege in your application manifest's file app.manifest

XML
<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" />
      </requestedexecutionlevel></requestedprivileges>
    </security> 
</trustinfo>


You can get this from Visual Studio via the Project properties -> Application Tab -> View Windows Settings.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900