3

I am new to .Net Core 2 and having problems trying to access (in this specific case, but will need to access other Api's in time) Azure AD with a fresh .Net Core 2 Visual Studio 2017 MVC web app.

I am getting

HttpRequestException: Response status code does not indicate success: 407 (Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )).

Which basically means that our corporate proxy server is not receiving the credentials needed to pass through ISA server.

As we nor our clients have no control over our/their corporate proxy server, or in clients case, machine configurations as everything is locked down, its always been up to our apps to supply the correct credentials that ISA needed. With ASP.Net its been just a matter of adding the following to app.config or web.config which obviously do not exist in Core 2:

<system.net>
   <defaultProxy useDefaultCredentials="true" />
</system.net>

I have proven, by running the equivalent non core version of the application, that this workaround should fix the problem.

However, with .Net Core 2, we have not found a way to implement this, either via middleware read configuration file, or programatically, ie in middleware say via WebProxy class/IWebProxy Interface, the latter has been tried but had no success - no evidence of the class instantiating in middleware.

I've seen comments in earlier versions of Core where people suggest implementing IWebProxy (no longer needed it seems as WebProxy class is available now) but no information how it gets hooked in.

How do we tell an .Net Core 2 MVC application to use default credentials when accessing the web?

  • In light of no answers so far, lets change the question. –  Dec 04 '17 at 10:15
  • Is it possible for an .Net Core 2 app to access resources behind a proxy server that requires authenticating with credentials ie automatically use ISA proxy settings from IE, without any special rules being setup in the proxy server or on local machine. –  Dec 04 '17 at 10:20
  • This sound similar to an issue I’m having which I logged in SO https://stackoverflow.com/questions/47874202/net-core-2-0-proxy-requests-always-result-in-http-407-proxy-authentication-req – Chet Dec 18 '17 at 21:22
  • It does sound similar Chet. We are not seeing our problem now in dev which is worrying. Our firewall guy made some changes to try to work around the issue and we made some config tweakes to our configuration (ie we created it from first principles for us rather than tweaking it from the numerous Azure tutorials we followed) so we don't know if its some residual firewall rules in place or it was our config changes - not helped by our corporate firewall being changed beneath our feed outside our control. –  Dec 21 '17 at 11:57
  • I've logged an [issue](https://github.com/dotnet/corefx/issues/25997) in the .NET Core project and its been tagged as "bug" so I'm assuming its a confirmed bug. Do you have a workaround for this issue? We have no control over the proxy (its a remote service from a 3rd party). – Chet Dec 28 '17 at 10:40
  • Thanks for pursuing this Chet. We don't have a workaround other than after some tweaking by our security guy so we can at least progress with this in dev environment. Hopefully it will be sorted by time we need to go in other environments. –  Jan 02 '18 at 10:32
  • Is this related I wonder https://stackoverflow.com/questions/47556772/proxy-server-error-407-in-core-2-azure-and-other-web-apis It's marked as resolved in .NET 7.0 – Andrew Sexton May 11 '23 at 12:36

0 Answers0