I have a bit of code which is annoying me because it is generating obsolete warnings, but I am wary of removing it because :
a) I works
b) I didn't write it
c) I don't currently have a means of testing it. (Ie I don't have access to a machine where it is required)
The code is as follows
System.Net.WebProxy proxyObject = System.Net.WebProxy.GetDefaultProxy();
proxyObject.Credentials = System.Net.CredentialCache.DefaultCredentials;
proxyObject.BypassProxyOnLocal = true;
System.Net.GlobalProxySelection.Select = proxyObject;
The warning message is
Warning 31 'System.Net.GlobalProxySelection' is obsolete: 'This class has been deprecated. Please use WebRequest.DefaultWebProxy instead to access and set the global default proxy. Use 'null' instead of GetEmptyWebProxy. http://go.microsoft.com/fwlink/?linkid=14202'
But, if my understanding is correct, (and assuming that the webservice the program is trying to access will never be local) what I really should do is just delete these four lines?
Is this correct, or have a missed something?
PS. I know there is probably a #pragma option to ignore the warning, but don't really want to go down that route.