views:

31

answers:

1

Hi,

I have written one VSTS data driven test case. Where I need to update IE proxy setting for individual test cases. I have written following line of code to change proxy

        RegistryKey reg = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections", true);
        string va = reg.GetValue("DefaultConnectionSettings").ToString();
        reg.SetValue("DefaultConnectionSettings", @"hex:3c,00,00,00,15,00,00,00,01,00,00,00,0e,00,00,\00,31,32,37,2e,30,2e,30,2e,31,3a,38,30,38,30,09,00,00,00,6c,6f,63,61,6c,68,\6f,73,74,0b,00,00,00,31,31,31,2e,31,31,2e,31,31,31,31,01,00,00,00,00,00,00,\00,30,fd,35,de,8d,27,c6,01,03,00,00,00,c0,a8,01,73,c0,a8,b8,01,c0,a8,85,01,\00,00,00,00,00,00,00,00 ");

        RegistryKey RegKey = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
        RegKey.SetValue("ProxyServer", "proxyvalue");
        RegKey.SetValue("ProxyEnable", 1);

It changes the proxy for first test case, but it does not change from 2nd test csaes.

Please help to identify what I'm doing wrong here.

Thanks, Pritam

A: 

Actually i didn't test it, but i think the IE will read in the registry value only on start-up. So make sure you close all IE processes before changing these values and starting your new test.

Oliver
I'm not calling any IE process directly, but I have used Process class which is calling some command line tool and this tool open IE. I have tried to close the process after each test case run.It doesn't solve my problem.
Pritam Karmakar