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

Enable auto detection of proxy configuration #21

Open
snakefoot opened this issue Oct 26, 2017 · 1 comment
Open

Enable auto detection of proxy configuration #21

snakefoot opened this issue Oct 26, 2017 · 1 comment

Comments

@snakefoot
Copy link
Contributor

snakefoot commented Oct 26, 2017

            IWebProxy proxy = WebRequest.GetSystemWebProxy();
            proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
            request.Proxy = proxy;
            request.PreAuthenticate = true;

Cache the default proxy to avoid auto lookup for every WebRequest.

Maybe a tristate (Explicit Proxy, Auto Proxy, Without Proxy - null):

https://stackoverflow.com/questions/2519655/httpwebrequest-is-extremely-slow

Can also be configured globally for the entire application:

<system.net>
    <defaultProxy enabled="true" useDefaultCredentials="true">
         <proxy usesystemdefault="True" />
    </defaultProxy>
</system.net>

https://msdn.microsoft.com/en-us/library/dkwyc043.aspx

@nblumhardt
Copy link
Member

Thanks @snakefoot , makes sense! 👍

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

No branches or pull requests

2 participants