We have a MVC 4 website using windows authentication and need to pass the logged in user's credentials to the Web API service we're calling. This works using WebClient, but we're unable to get the new HttpClient class to pass the credentials to the service.
Here's the code being used for instantiating the HttpClient.
```
var httpClient = new HttpClient(new HttpClientHandler()
{
UseDefaultCredentials = true
});
httpClient.GetStringAsync("http://localhost/some/endpoint/");
```
Disassembly of the code shows that it's checking the FlowImpersonation flag to determine if the impersonation code gets run, but we're unable to get the flag change the flag setting through aspnet_config.config. The following stackoverflow articles describe the issue in more detail.
http://stackoverflow.com/questions/12212116/how-to-get-httpclient-to-pass-credentials-along-with-the-request
http://stackoverflow.com/questions/10308938/unable-to-authenticate-to-asp-net-web-api-service-with-httpclient
Comments: We tracked this bug to be outside of MVC/Web API and opened a bug internally for HttpClient. If you want to track the status, please use the http://connect.microsoft.com/ site, to open a bug
Here's the code being used for instantiating the HttpClient.
```
var httpClient = new HttpClient(new HttpClientHandler()
{
UseDefaultCredentials = true
});
httpClient.GetStringAsync("http://localhost/some/endpoint/");
```
Disassembly of the code shows that it's checking the FlowImpersonation flag to determine if the impersonation code gets run, but we're unable to get the flag change the flag setting through aspnet_config.config. The following stackoverflow articles describe the issue in more detail.
http://stackoverflow.com/questions/12212116/how-to-get-httpclient-to-pass-credentials-along-with-the-request
http://stackoverflow.com/questions/10308938/unable-to-authenticate-to-asp-net-web-api-service-with-httpclient
Comments: We tracked this bug to be outside of MVC/Web API and opened a bug internally for HttpClient. If you want to track the status, please use the http://connect.microsoft.com/ site, to open a bug