在单在OSX我如何才能获得当前代理?OSX

2023-09-03 20:28:50 作者:余生一个浪

GetSystemWebProxy 和的 DefaultWebProxy 返回null。

  WebRequest.GetSystemWebProxy();
WebRequest.DefaultWebProxy;
 

解决方案 在Mac OS X 中怎样获取当前文件夹的路径

如果您使用的是最新版本的 monomac (或从源代码编译的话),那么你应该能够调用静态方法 CFNetwork.GetDefaultProxy (来源,看文件的末尾),以获得的 IWebProxy 实例应匹配什么OSX使用。

Both GetSystemWebProxy and DefaultWebProxy return null.

WebRequest.GetSystemWebProxy();
WebRequest.DefaultWebProxy;

解决方案

If you use a recent version of monomac (or build it from source) then you should be able to call the static method CFNetwork.GetDefaultProxy (source, look at the end of the file) to get an IWebProxy instance that should match what OSX is using.