Facebook SDK代理设置C# [英] Facebook SDK Proxy setting C#
本文介绍了Facebook SDK代理设置C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用Facebook SDK .net,但我使用具有身份验证的代理连接到Internet 我收到错误消息(407)(407),这是我必须如何在Facebook SDK上设置身份验证所必需的
I use Facebook SDK .net but I use proxy with authentication to connect to the internet I get the error (407) (407) proxy authentication required how I can set the authentication on Facebook SDK
推荐答案
FacebookClient中有一个静态方法,允许您全局设置它.
There is a static method in FacebookClient which allows you to set it globally.
[EditorBrowsable(EditorBrowsableState.Never)]
public static void SetDefaultHttpWebRequestFactory(Func<Uri, HttpWebRequestWrapper> httpWebRequestFactory)
您可能不会在智能感知中看到它,因为默认情况下它是隐藏的.
You might not see it in the intellisense as it is hidden by default.
如果每个实例都需要它,则可以使用该属性.
If you want it per instance you can use the property.
[EditorBrowsable(EditorBrowsableState.Never)]
public virtual Func<Uri, HttpWebRequestWrapper> HttpWebRequestFactory { get; set; }
这里是一个例子.
FacebookClient.SetDefaultHttpWebRequestFactory(uri => {
var request = new HttpWebRequestWrapper((HttpWebRequest)WebRequest.Create(uri));
request.Proxy = ......; // normal .net IWebProxy
return request;
});
这篇关于Facebook SDK代理设置C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文