2

I'm certain I've done this a dozen times before, and I can't think what's causing this to fail now, but, I have an MVC web app with its app pool running as a domain account. It connects to a WebAPI app on the same domain which has Windows auth enabled.

I'd like to be able to read the MVC app pool account name using controller.User.Identity.Name on the WebAPI side, but it's coming back empty. I've tried just about everything, including explicitly setting the MVC app to "connect as specific user".

The MVC app is using HttpClient to connect to the API. I've tried passing an HttpClientHandler with UseDefaultCredentials set to true, but that had no effect.

Connecting to the WebAPI methods from my local machine correctly identifies my domain account. Is there something obvious I'm missing?

Rob Bell
  • 3,542
  • 5
  • 28
  • 49

1 Answers1

0

This was fixed by adding the BackConnectionHostNames key mentioned here:

https://stackoverflow.com/a/10311823/2179408

It wasn't necessary for me to make the legacyImpersonationPolicy and alwaysFlowImpersonationPolicy aspnet.config changes though.

The 401 responses I was receiving threw me off and led me to believe it was an IIS authentication issue.

Community
  • 1
  • 1
Rob Bell
  • 3,542
  • 5
  • 28
  • 49