WebRequest throws IOException “The specified registry key does not exist.”

When you are using .NET 2.0 or .NET 3.5 and you are trying to make a web request with WebRequest class you may see the following internal error if you have Common Language Runtime Exceptions enabled during debugging in Visual Studio:

Exception thrown: ‘System.IO.IOException’ in mscorlib.dll
Additional information: The specified registry key does not exist.

To fix it, add the following registry keys into registry (.reg):

Windows Registry Editor Version 5.00