C# auto detect proxy settings

后端 未结 8 752
遇见更好的自我
遇见更好的自我 2020-12-01 06:37

C# 2008 SP1

I am using the code to detect if a proxy has been set under \"Internet Options\". If there is a proxy then I will set this in my webclient.

So I

8条回答
  •  时光说笑
    2020-12-01 07:15

    First, GetDefaultProxy is marked as deprecated so you have no guarantee it will be around in even the immediate future. Second, Address can be null so the code you gave risks a NullReferenceException:

提交回复
热议问题