arşiv

0, 2018 için arşiv

web.config ‘e proxy eklemek

Perşembe, 02 Ağu 2018 yorum yok
<system.net>
    <defaultProxy useDefaultCredentials="true">
      <proxy
        usesystemdefault="True"
        proxyaddress="http://127.X.X.X:8080"
        bypassonlocal="True"
      />
    </defaultProxy>
  </system.net>

 

Categories: C# Tags: ,

Is it possible to specify proxy credentials in your web.config?

Perşembe, 02 Ağu 2018 yorum yok
namespace SomeNameSpace
{
    public class MyProxy : IWebProxy
    {
        public ICredentials Credentials
        {
            get { return new NetworkCredential("user", "password"); }
            //or get { return new NetworkCredential("user", "password","domain"); }
            set { }
        }

        public Uri GetProxy(Uri destination)
        {
            return new Uri("http://my.proxy:8080");
        }

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

 

<defaultProxy enabled="true" useDefaultCredentials="false">
  <module type = "SomeNameSpace.MyProxy, SomeAssembly" />
</defaultProxy>

 

Kaynak: https://stackoverflow.com/questions/186800/is-it-possible-to-specify-proxy-credentials-in-your-web-config#

Categories: C# Tags: