0
votes

We have a classic asp.net web API service running on Azure VM(IIS) and its configured as back end pool in azure application gateway, and the API service is running on windows NTLM authentication (in order to support some backward compatibility and dependency on a legacy component). One of the controllers in the API is for uploading service. and it’s working fine while I’m calling the service using Insomnia/postman directly through app gateway endpoint.
But when I’m trying to consume the same app gateway endpoint through a .Net core client application. its always unauthorized. The app gateway is not sending the NTLM header to the back end pool

Here is the client code that I used to consume the service

enter image description here

1

1 Answers

0
votes

After a long day of digging to the problem with Application gateway and IIS log. Finally, I was able to figure out the issue. Problem is primarily related to .Net Core HttpClient . HttpClient was failing to send the NTLM header details while calling PostAsync method with multipart form data. So rather than calling PostAsync I have to use SendAsync method in following way after disabling SocketsHttpHandler

enter image description here