AL icon indicating copy to clipboard operation
AL copied to clipboard

Network Credentials on HttpRequestMessage

Open nmahate opened this issue 8 years ago • 5 comments

Is it possible to add network credentials to a HttpRequestMessage. In C/AL we were able to use a variable of type System.Net.NetworkCredential.'System and then call

NetworkCredential := NetworkCredential.NetworkCredential(UserName,Password,Domain);
HttpWebRequest.Credentials := NetworkCredential;

Are there any examples of using this on HttpRequestMessage or HttpHeaders in AL?

nmahate avatar May 10 '18 15:05 nmahate

The HttpWebRequest class has been obsolete for a long, long time in the .net framework. You can use the request headers of the HttpClient/HttpRequestMessage to take care of authentication.

erikrijn avatar May 11 '18 10:05 erikrijn

@erikrijn We can add basic authorization to the HttpHeader but we're after an example using Network Credentials with a domain.

nmahate avatar May 14 '18 10:05 nmahate

Any update/answer on this? @StanislawStempin

nmahate avatar May 29 '18 09:05 nmahate

You should inspect how the http request looks like when using your original .NET code and then recreate the same request by directly inserting the relevant values into the http headers.

StanislawStempin avatar Aug 03 '18 13:08 StanislawStempin

Is there any example on how to use network credentials with http headers ? I cannot find a solution to that on AL

abouraoui avatar Dec 10 '18 20:12 abouraoui