开发者

C#: WebRequest proxy = null side effects

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜