Hi,
We have one utility application which we need to get the "ProxyOverride" value from HKEY_CURRENT_USER internet settings. When I run the code from desktop application. I am able to get the value from the following windows registry.
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings
But, When I run the application as a service then application is looking into the below windows registry
HKEY_USERS.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings
Find the below code snippet for your reference.
const string Subkey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\";
string bypassProxyValue = string.Empty;
using (RegistryKey regKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default).OpenSubKey(Subkey))
{
string[] keys = regKey.GetValueNames();
bypassProxyValue = regKey.GetValue("ProxyOverride").ToString();
}
Above code is perfectly working when we run from desktop and the same code is not working when we run as a service. Appreciate your quick help.
Thanks