HttpWebRequest throws “The specified registry key does not exist.”
2013, May 20
Encountered a strange issue today, upon executing the following line of code, a “The specified registry key does not exist.” error was thrown.
A little googling reveals that the cause was a windows security update that was rolled out at work: MS12-074
HttpWebRequest wreq = (HttpWebRequest)WebRequest.Create(url);
Here’s a quote from the Microsoft KB article;
To enable the legacy functionality of WPAD, create the LegacyWPADSupport value in the following registry subkey:Registry location: HKEY_LOCAL_MACHINESOFTWAREMicrosoft.NETFramework
DWORD (32-bit) Value name: LegacyWPADSupport
Value data: 1
The fix was to create the registry key with a value of 0.