开发者

C#: WebRequest proxy = null side effects

开发者 https://www.devze.com 2023-04-03 15:22 出处:网络
Does anyone know what the side effects are of having a webrequest.proxy = null in a HttpWebRequest? MSDN (.NET Framework 4) says to use GlobalProxySelection.GetEmptyWebProxy() when no proxy should b

Does anyone know what the side effects are of having a webrequest.proxy = null in a HttpWebRequest?

MSDN (.NET Framework 4) says to use GlobalProxySelection.GetEmptyWebProxy() when no proxy should be used. A blank IWebProxy instance will be returned. Visual Studio says it's deprecated!!

Does the webrequest in both cases still work if the user's network requires proxy settings?

So, what is the correct approach and any kn开发者_如何学编程own issues/side effects when a proxy is needed?


About the deprecated issue; Visual Studio says: Use null instead


No, there are no side effects.
VS is advising you correctly.

Does the webrequest in both cases still work if the user's network requires proxy settings?

An entirely different question. Your connection will most likely not work. Use WebRequest.DefaultWebProxy instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消