Skip to main content

Posts

Showing posts with the label #Read HTTPResponse Header

#MVC #API Create and Read custom header.

Website In EmespmdHttpClient class add public void SetUserIdentifier( string userIdentifier)         {             this .DefaultRequestHeaders.Add( "EMESPMD-USER" , userIdentifier);         } From action method send _loggedInUser.XomPersonnelId as a separate param(naming userIdentifier) to each service call. In Gateway service add below line next to try{        _emespmdHttpClient.SetUserIdentifier(userIdentifier); Service Create an extension( HttpRequestExtensions ) method in EMESPMD.Api.MessageHandler folder. public static class HttpRequestExtensions     {         public static string RequestedUserIdentifier( this HttpRequestMessage request)         {         ...