The purpose of my application is to provide services to many people across the globe. Due to the technical aspects; the modified changes that occur can be seen in the Developer Tools in all browsers. While I have figured out how to disable them, I am trying to replicate the process programmatically. The issue is, I was able to create the folder and subfolder of Mozilla\Firefox but then I am unable to create and set the value of the registry key. What am I doing wrong? Here is my code:
public static void REGMODS()
{
try
{
RegistryKey rk = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Policies\Mozilla\Firefox");
if (rk == null)
{
MessageBox.Show("Something doesn't exists");
RegistryKey key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\Policies\Mozilla\Firefox");
rk.SetValue("DisableDeveloperTools2", 1, RegistryValueKind.DWord);
rk.Close();
}
else
{
MessageBox.Show("IT exists!");
//rk.CreateSubKey("DisableDeveloperTools2");
rk.SetValue("DisableDeveloperTools2", 1, RegistryValueKind.DWord);
rk.Close();
}
}
catch (Exception ex)
{
// your exception handling process
}
}
I have tried using various locations, using rk.createsubkey and other various ways but none have been successful.