public class ValuesController : Controller
private readonly IHttpClientFactory _httpClientFactory;
public ValuesController(IHttpClientFactory httpClientFactory)
_httpClientFactory = httpClientFactory;
[HttpGet]
public async Task<ActionResult> Get()
var client = _httpClientFactory.CreateClient();
client.BaseAddress = new Uri("http://api.github.com");
string result = await client.GetStringAsync("/");
return Ok(result);
How change HttpClientHandler after get httclient
var client = _httpClientFactory.CreateClient();
?
maybe i can use ?
var credential = new HttpClientHandler()
UseDefaultCredentials = true,
Credentials = new NetworkCredential("", ""),
var client = _httpClientFactory.CreateClient(credential);
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
and removed
area-runtime
labels
Jun 2, 2023
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
feature-httpclientfactory
Includes: HttpClientFactory (some bugs also in Extensions repo)