diff --git a/docs/core/extensions/httpclient-factory.md b/docs/core/extensions/httpclient-factory.md index f06cec7e86c72..c783bf916611c 100644 --- a/docs/core/extensions/httpclient-factory.md +++ b/docs/core/extensions/httpclient-factory.md @@ -12,8 +12,9 @@ In this article, you'll learn how to use the `IHttpClientFactory` interface to c With modern application development principles driving best practices, the serves as a factory abstraction that can create `HttpClient` instances with custom configurations. was introduced in .NET Core 2.1. Common HTTP-based .NET workloads can take advantage of resilient and transient-fault-handling third-party middleware with ease. -> [!NOTE] -> If your app requires cookies, it might be better to avoid using in your app. For alternative ways of managing clients, see [Guidelines for using HTTP clients](../../fundamentals/networking/http/httpclient-guidelines.md). +> [!WARNING] +> If your app requires cookies, it's recommended to avoid using . Pooling the instances results in sharing of objects. Unanticipated sharing might leak cookies between unrelated parts of the application. Moreover, when expires, the handler is recycled, meaning that all cookies stored in its are lost. +> For alternative ways of managing clients, see [Guidelines for using HTTP clients](../../fundamentals/networking/http/httpclient-guidelines.md). > [!IMPORTANT] > Lifetime management of `HttpClient` instances created by `IHttpClientFactory` is completely different from instances created manually. The strategies are to use either **short-lived** clients created by `IHttpClientFactory` or **long-lived** clients with `PooledConnectionLifetime` set up. For more information, see the [HttpClient lifetime management](#httpclient-lifetime-management) section and [Guidelines for using HTTP clients](../../fundamentals/networking/http/httpclient-guidelines.md). diff --git a/docs/fundamentals/networking/http/httpclient-guidelines.md b/docs/fundamentals/networking/http/httpclient-guidelines.md index 0e42789860228..bb610ac8cad6f 100644 --- a/docs/fundamentals/networking/http/httpclient-guidelines.md +++ b/docs/fundamentals/networking/http/httpclient-guidelines.md @@ -49,8 +49,8 @@ To summarize recommended `HttpClient` use in terms of lifetime management, you s - In .NET Framework, use to manage your `HttpClient` instances. If you don't use the factory and instead create a new client instance for each request yourself, you can exhaust available ports. - > [!TIP] - > If your app requires cookies, consider disabling automatic cookie handling or avoiding . Pooling the instances results in sharing of objects. Unanticipated object sharing often results in incorrect code. + > [!WARNING] + > If your app requires cookies, it's recommended to avoid using . Pooling the instances results in sharing of objects. Unanticipated sharing might leak cookies between unrelated parts of the application. Moreover, when expires, the handler is recycled, meaning that all cookies stored in its are lost. For more information about managing `HttpClient` lifetime with `IHttpClientFactory`, see [`IHttpClientFactory` guidelines](../../../core/extensions/httpclient-factory.md#httpclient-lifetime-management).