0

Our system when we are on the corporate network connects through a proxy, I'm struggling to get my application to connect

The only way i've been able to get it to connect is without a proxy, off our corp network. The proxy url is a internal url, only available on the corp network

I've tried setting a proxy up, PROXY URL replaced by what's in the computers proxy settings

public class ProxySupportedHttpClientFactory : HttpClientFactory
{
    protected override HttpMessageHandler CreateHandler(CreateHttpClientArgs args)
    {
        var proxyAddress = "PROXY URL";
        var proxy = new WebProxy(proxyAddress, true, null, CredentialCache.DefaultNetworkCredentials);
        var webRequestHandler = new HttpClientHandler()
        {
            UseProxy = true,
            Proxy = proxy,
            UseCookies = false
        };
        return webRequestHandler;
    }
}

With the proxy set in code I get the following behaviour

With

On Corp it shows Error 400

Off Corp it shows Can't find host

Without

On Corp it shows the proxy login prompt

Off Corp then it works as expected

How do I make it so that it mirrors what happens with web browsers etc. That when its on the corp network, it goes through the proxy, when its off it doesn't

The computers proxy settings are set to

automatically detect = on

setup script = on

script address = set to internal url
Ceri Turner
  • 830
  • 2
  • 12
  • 36
  • The namespace (prefix) need to be added to the DNS. Use from cmd.exe >IPConfig/all to get a list of Prefixes. – jdweng Jun 29 '21 at 13:58
  • Any idea what i'm looking for, none of them show namespace or prefix. It shows a suffix but no prefix. Also, where would i add it in the code – Ceri Turner Jun 29 '21 at 14:09
  • They are domain names. See Wildcard DNS records at Wiki : https://en.wikipedia.org/wiki/Domain_Name_System?force_isolation=true – jdweng Jun 29 '21 at 14:58
  • I’m confused. I know what a DNS is but I’m not sure what I need to do to get it working – Ceri Turner Jun 29 '21 at 15:57
  • I think you need to connect using a Domain Name to server. The IP may be blocked. – jdweng Jun 29 '21 at 16:05
  • I would have thought if the up was blocked I wouldn’t be able to access via browser either. The same url loads when on browser but not the app – Ceri Turner Jun 29 '21 at 16:21

0 Answers0