IE Intranet zone > Require server verification ... How to check programaticaly ?

G

gbraux

Hello,

I am dealing with security zones in Internet Explorer.

I know how to add websites programaticaly to the intranet zone (using
IInternetSecurityManager::SetZoneMapping).
But do anyone know how to check/uncheck programaticaly the "Require
server verification (https:) from all sites in this zone" ?
I looked all over MSDN, but do not find a function dealing with this
....

Thanks,

Guillaume BRAUX
 
G

gbraux

Solution :

public bool SetHttpsIeZone(bool value,int ie_zone)
{
RegistryKey key = Registry.CurrentUser.OpenSubKey(
@"Software\Microsoft\Windows\CurrentVersion\Internet
Settings\Zones\" + ie_zone.ToString(),true);

Int32 keyValue = (Int32)key.GetValue("Flags");

//Le bit du flag qui gere cette protection est le 6eme
//On va convertir la valeur du flag en binaire, l'exploser
dans un tableau de char et le reconstruire

string binString = Convert.ToString(keyValue, 2);
char[] binChar = binString.ToCharArray();


if (value) { binChar[5] = (char)49; }
if (!value) { binChar[5] = (char)48; }

string newBinString = new string(binChar,0,binChar.Length);
int newKey = Convert.ToInt32(newBinString, 2);

key.SetValue("Flags", newKey,RegistryValueKind.DWord);
key.Flush();
key.Close();

return true;
}



gbraux a écrit :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top