Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Location of IWebProxy implementation for .NET Core

What is the available implementation of the System.Net.IWebProxy (from System.Net.Primitives, DNX Core)? By application requirement, the only framework can be used in dnxcore50, so what is the right NuGet package that contains proxy implementations?

What is the correct way to resolve such questions? Related functionality seems to be split among dozen of packages.

like image 635
Pavel Baravik Avatar asked Feb 12 '16 22:02

Pavel Baravik


2 Answers

Despite the name, IWebProxy implementation does not actually need to implement any proxying, it just provides information about the proxy. So, you can create your own implementation:

public class MyProxy : IWebProxy
{
    public Uri GetProxy(Uri destination)
    {
        return new Uri("http://localhost:8888");
    }

    public bool IsBypassed(Uri host)
    {
        return false;
    }

    public ICredentials Credentials { get; set; }
}
like image 187
alex Avatar answered Oct 11 '22 11:10

alex


There is a WebProxy class in the System.Net namespace (source here) that you can use.

like image 22
Mark Vincze Avatar answered Oct 11 '22 11:10

Mark Vincze