Search code examples
proxyrestsharp

RestSharp for .Net Framework how to make a RestRequest with Direct connection (without Proxy)


I'm using RestSharp 106.6.10. The need is to make a request skipping the default Proxy, as I thought:

var client = new RestClient("https://<my ip>");
client.Proxy = null; //=> it is null by default, in reality
...
var request = new RestRequest("streams/..."

But in reality the Default Proxy is used, and the request is rejected by the Proxy for authentication issue.

Any idea?

Thanks, Lorenzo


Solution

  • Solved

    1) client.Proxy = null; => not working (as already said)

    2) client.Proxy = GlobalProxySelection.GetEmptyWebProxy(); => OK but deprecated

    3) client.Proxy = new WebProxy(); => works fine

    Hoping it could be of any help to others, thanks everybody.

    Lorenzo