WebClient.DownloadString gives the first exception

A call to WebClient.DownloadString gives an exceptional exception:

IOException: The specified registry key does not exist. 

For some time now I have been getting the first exceptions that run our software in existing code.

We have a policy according to which our code should work without providing exceptions for the first change in order to facilitate debugging.

The first random exception occurs in the WebClient class when calling DownloadString and in a remote access script where the remote host is unavailable.

Does anyone know how we can prevent this first exception?

I am running VS 2010 on a machine with Windows 8. As far as I know, I do not have antivirus or firewalls.

The code runs in x86 mode for the .NET Framework 4.0 with debugging enabled. The code is a combination of VB.Net and C #

+6
source share
1 answer

This is a .NET issue, Microsoft has released an update here:

http://technet.microsoft.com/en-us/security/bulletin/ms12-074

You can add a registration key that does not contain your name:

 Registry location: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework DWORD (32-bit) Value name: LegacyWPADSupport Value data: 0 

and for 64-bit machines:

 Registry location: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework DWORD (32-bit) Value name: LegacyWPADSupport Value data: 0 
+3
source

All Articles