0 Replies - 1129 Views - Last Post: 22 April 2019 - 09:14 AM

#1 fearfulsc2   User is offline

  • D.I.C Regular

Reputation: 16
  • View blog
  • Posts: 281
  • Joined: 25-May 16

How to pass Correct Http Header

Posted 22 April 2019 - 09:14 AM

Hi everyone, I am using the .net core framework and I am having an issue with trying to pass the correct http request headers to another service.

When I run locally on my machine, I get the headers from my own credentials and can pass it along without having to do much of anything. I just say use default credentials.

When I deploy the application to a server and then call that service, it will use my credentials to access that service as expected. The issue lies when that service calls another service. When I do logging, the secondary service is using the credentials of the application pool identity.

How can I pass my credentials through the http headers so that when the second service is called, it sees my credentials instead of the application pool?

This is what I have so far

 HttpClient client = this.httpSvc.GETSERVICECLIENT();

client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Windows"); // I thought this would work but does not

            HttpResponseMessage response = await client.GetAsync($"api/user/DOSOMETHING");

            response.EnsureSuccessStatusCode();


This post has been edited by fearfulsc2: 22 April 2019 - 09:20 AM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1