A
aditya satya prakash
Guest
Hi there,
I have developed C# application using Visual Studio 2017. The problem I face is when I double click on the application on windows 10 it throws an error saying "System.Security.SecurityException". If I right click on exe and then click on run as an administrator it runs fine.
Can anyone please tell me is this a windows' security problem or my deployment problem?
I am using the below code to open and get the registry key. And Here I am getting the exception while calling OpenSubKey.
public RegistryKey GetRegKeyHandle(String key)
{
key = BASE_REG_KEY + "\\" + key;
if (MainFrame.GetUIControlObject().MGDIsAdmin())
{
regWritable = true;
RegistryKey rkTest = Registry.LocalMachine.OpenSubKey(key, true);
return rkTest;
}
else
{
return Registry.LocalMachine.OpenSubKey(key);
}
}
I am also using the manifest file with the below line of code:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
Please provide your thoughts on this?
Y A S Prakash
Continue reading...
I have developed C# application using Visual Studio 2017. The problem I face is when I double click on the application on windows 10 it throws an error saying "System.Security.SecurityException". If I right click on exe and then click on run as an administrator it runs fine.
Can anyone please tell me is this a windows' security problem or my deployment problem?
I am using the below code to open and get the registry key. And Here I am getting the exception while calling OpenSubKey.
public RegistryKey GetRegKeyHandle(String key)
{
key = BASE_REG_KEY + "\\" + key;
if (MainFrame.GetUIControlObject().MGDIsAdmin())
{
regWritable = true;
RegistryKey rkTest = Registry.LocalMachine.OpenSubKey(key, true);
return rkTest;
}
else
{
return Registry.LocalMachine.OpenSubKey(key);
}
}
I am also using the manifest file with the below line of code:
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
Please provide your thoughts on this?
Y A S Prakash
Continue reading...