Share via


Proxy Server error 407 in Core 2 - Azure

Question

Wednesday, November 29, 2017 6:03 PM

I am new to .Net Core 2 and having problems trying to access 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 have no control over our corporate proxy server, 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

<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 config file, or programatically, ie in middleware say via WebProxy class/IWebProxy Interface, the latter has been tried but had no success.

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

Many thanks

All replies (1)

Thursday, November 30, 2017 3:17 AM

Hi lanH64,<o:p></o:p>

.Net Core does not have a configuration system for BCL, web.config only works for IIS specific settings, so the system.net section will be ignored. I suggest you try to change the machine.config like below:<o:p></o:p>

# Package manager in Visual Studio 2015 “407 (Proxy Authentication Required)”<o:p></o:p>

https://stackoverflow.com/questions/36310915/package-manager-in-visual-studio-2015-407-proxy-authentication-required<o:p></o:p>

For another option, I suggest you check whether it will work by implementing Proxy Middleware.<o:p></o:p>

# Creating a proxy to another web api with Asp.net core<o:p></o:p>

https://stackoverflow.com/questions/42000362/creating-a-proxy-to-another-web-api-with-asp-net-core<o:p></o:p>

Best Regards,<o:p></o:p>

Edward<o:p></o:p>