1
votes

I need use AuthenticationHeaderValue for getting token

var token = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes($"{username}:{password}")));

so I have to install System.Net.Http package but when I install it via package manager console it give that error what should I do? what is AuthenticationHeaderValue alternative?

Could not install package 'System.Net.Http 4.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0', but the package does not contain any assembly references or content files that are compatible with that framework.

1

1 Answers

2
votes

Install System.Net.http version which is compatible to your .Net Framework