Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RestSharp 106.1.0 not using system proxy in .NET Framework #1043

Closed
rogerdc opened this issue Nov 21, 2017 · 9 comments
Closed

RestSharp 106.1.0 not using system proxy in .NET Framework #1043

rogerdc opened this issue Nov 21, 2017 · 9 comments

Comments

@rogerdc
Copy link

rogerdc commented Nov 21, 2017

Expected Behavior

When using RestSharp 106.1.0 in a project for the .NET Framework, the system proxy should be used and all requests should be routed through it. In this specific case, I'm using Fiddler as a local proxy. Web browsers are routing through this Proxy.

Actual Behavior

Traffic from RestSharp is evidently not routed through the proxy and not picked up by Fiddler.

Steps to Reproduce the Problem

  1. Create a .NET Framework project using RestSharp. I used https://github.com/rogerdc/RestSharpProxyTestForDotNETFramework. You can obtain your own key for the Dark Sky API at https://darksky.net/dev/register.
  2. Run Fiddler to set up a local proxy (https://www.telerik.com/fiddler)
  3. Run the console application in the project to send API requests to Dark Sky.

Specifications

  • Version: 106.1.0
  • Platform: Windows 10, Visual Studio 2017 Community
  • Subsystem:

StackTrace

None.

@rogerdc rogerdc changed the title RestSharp not using system proxy in .NET Framework RestSharp 106.1.0 not using system proxy in .NET Framework Nov 21, 2017
@teban1812
Copy link

Same here with 106.1.0 and .Net Core 2.0

@alexeyzimarev
Copy link
Member

Can you guys check the latest alpha, I made some updates addressing the default proxy issue.

@rogerdc
Copy link
Author

rogerdc commented Dec 24, 2017

Retested with 106.2.0 and I can see my .NET Framework requests in Fiddler now.

Great work.

I'm holding off on closing until @teban1812 checks with his .NET Core requests.

@alexeyzimarev
Copy link
Member

Referring to #1061

.NET Core will not support system proxy. Full framework does.

@ViktorHofer
Copy link

ViktorHofer commented Feb 6, 2018

@alexeyzimarev please try using the default proxy again with the latest .NET Core 2.0 bits. We fixed something related to this in on of the servicing releases: dotnet/corefx#23885

@sirkris
Copy link

sirkris commented Mar 5, 2019

Is there a status update on this? I have an open request to add proxy support to my .NET Standard library that uses RestSharp and this is blocking me. Is the problem still that .NET Core doesn't support it? The most recent comment from just over a year ago suggests there may be a solution.

@alexeyzimarev
Copy link
Member

@sirkris not sure what the issue is at the moment. We try getting the system proxy and we ignore if we get PlatformNotSupportedException. I tested it in Windows with Fiddler on both Core and full .NET and I had no issues.

@nmg196
Copy link

nmg196 commented Jun 18, 2020

In .NET Core 3.1, RestSharp 106.11.4 ignores the Windows system proxy (eg Fiddler).
It works if I specify it explicity, but it would be better if it picked it up by default the same way browsers do.

@DavidMartinSerrano
Copy link

I´m using restsharp on a WPF project for calling a net core 3.1 api...Everything works ok except the proxy:
public void AddProxy(string ipPuerto, string usuario, string pass)
{
var proxyURI = new Uri($"http://{ipPuerto}");
ICredentials credentials = new NetworkCredential(usuario, pass);
var proxy = new WebProxy(proxyURI, false, null, credentials);
Client.Proxy = proxy;
GlobalVariables.UsaProxy = true;
}

It just ignores totally the proxy...I´m trying that proxy from wcf clients, from postman, and is working as expected...but, here is simply beign ignored.....I have the version 106.11.7 (latest at the moment) .... I have tried by all means (change httprequest.Default proxy, etc....) and nothing works...Can you please help guys???

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants