How to use proxy with TwitterConsumer class from DotNetOpenAuth.ApplicationBlock

347 Views Asked by At

I am currently implementing SSO with DotNetOpenAuth. However, when working locally, I need to send requests via a proxy. I am happy to do this programatically or via config setting but I am struggling to find where to add it to the TwitterConsumer class supplied in the application block.

Any help much appreciated

1

There are 1 best solutions below

0
On

So the easiest way is probably to set the proxy in your .config file or programmatically using WebRequest.DefaultWebProxy.

Alternatively, just set the proxy properties on the HttpWebRequest objects like any other .NET request. For those request objects you don't see because DotNetOpenAuth creates and issues them automatically, you can implement IDirectWebRequestHandler and pass that into DNOA so you get to intercept each outgoing HttpWebRequest, but that is considerably harder and probably not necessary considering your other options.