My application is redirected from https:\\application.domain.com to http:\\servername.domain.net
I'm using windows authentication with [authorize] control in webAPI.
Whether I call my webAPI to populate a datasource it works:
.DataSource(source => source
.Custom()
.Transport(transport =>
{
transport.Read(new
{
url = $"{WebApiUrl}",
xhrFields = new { withCredentials = true },
DataType = "json",
Data = "forgeryToken"
});
})
Instead if I use the HTTPCLIENT class it seems that the request loses the credentials and it returns an unauthorize error 401
services.AddHttpClient<Class>()
.ConfigurePrimaryHttpMessageHandler(handler =>
new HttpClientHandler()
{
AutomaticDecompression = System.Net.DecompressionMethods.GZip,
UseDefaultCredentials = true,
});
Whether I don't use the redirection and I call directly http:\\servername.domain.net it works.
How can I use HTTPCLIENT class to mantain the credential?
I know it's not related to telerik, but I don't understand why with telerik it works and I hope that someone can help me.
Thank you