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
Asked
Active
Viewed 2,086 times
2 Answers
8
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; }
Here is an example.
FacebookClient.SetDefaultHttpWebRequestFactory(uri => {
var request = new HttpWebRequestWrapper((HttpWebRequest)WebRequest.Create(uri));
request.Proxy = ......; // normal .net IWebProxy
return request;
});

prabir
- 7,674
- 4
- 31
- 43
-
I can't get it, there is no acebookClient.SetDefaultHttpWebRequestFactory my code is C# code – Ahmad Darwish Sep 04 '12 at 02:39
-
it is static not instance FacebookClient.SetDefaultHttpWebRequestFactory. It is hidden from intellisense so you might not see it. check the source code. – prabir Sep 04 '12 at 14:56
0
I recently had this issue when using FacebookClient
to post to a Facebook page. In my case I have a WCF service that is responsible for the Facebook interactions and the service sits behind a company proxy. This stackoverflow answer resolved the issue for me but requires the IIS app pool user identity for the service to be set to a user that has domain credentials, otherwise the 407 error is returned. So set the app pool identity to a domain account and add the following to web.config:
<system.net>
<defaultProxy useDefaultCredentials="true" />
</system.net>

Community
- 1
- 1

David Clarke
- 12,888
- 9
- 86
- 116