Closed jeyprakash closed 2 years ago
Hey @jeyprakash it sounds like you're connecting from behind a proxy that requires authentication? Can you confirm?
Hello @kevbite , yes, I'm behind the proxy. But the same APIs where called from the Microsoft Excel using VBA code and it works fine. The Excel VBA was written by someone. Now I'm trying to rewrite using PowerApps and using an API wrapper around CompaniesHouse. So, I'm bit confused here. Could you please help me on how can I overcome this via C# code ?
It doesn't seem like it's picking up the default proxy. Can you try explicitly setting these? Within the settings that you pass to the CompaniesHouseClient you can specify a HttpMessageHandler where you can setup the proxy settings.
var settings = new CompaniesHouseSettings(
CompaniesHouseUris.Default,
apiKey,
() => new HttpClientHandler()
{
Proxy = new WebProxy("https://my-proxy:8080"),
UseProxy = true
});
using var client = new CompaniesHouseClient( settings ));
await client.SearchAllAsync( request )
I'm closing this issue but feel free to reopen if you continue having problems. Thanks
I tried the sample project coding to connect CompaniesHouse API. But unfortunately I'm getting the below error,
HttpRequestException: Response status code does not indicate success: 407 (Proxy Authentication required).
I'm using the valid authentication key and passing on to the CompaniesHouseSettings( api_key ).
Could someone please help me on this issue?