Skip to content

Commit 79ef5e3

Browse files
bseptembertdykstra
andauthored
Improve documentation for CookiePolicyMiddleware and CookieOptions (#54968)
* Docs: Improve doc. for CookiePolicyMiddleware and CookieOptions * Docs: sentence structure, redundancy Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> * Docs: sentence structure, redundancy, format structure Co-authored-by: Tom Dykstra <tdykstra@microsoft.com> --------- Co-authored-by: Tom Dykstra <tdykstra@microsoft.com>
1 parent 7f6f942 commit 79ef5e3

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/Http/Http.Features/src/CookieOptions.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ namespace Microsoft.AspNetCore.Http;
88
/// <summary>
99
/// Options used to create a new cookie.
1010
/// </summary>
11+
/// <remarks>
12+
/// A <see cref="CookieOptions"/> instance is intended to govern the behavior of an individual cookie.
13+
/// Reusing the same <see cref="CookieOptions"/> instance across multiple cookies can lead to unintended
14+
/// consequences, such as modifications affecting multiple cookies. We recommend instantiating a new
15+
/// <see cref="CookieOptions"/> object for each cookie to ensure that the configuration is applied
16+
/// independently.
17+
/// </remarks>
1118
public class CookieOptions
1219
{
1320
private List<string>? _extensions;

src/Security/CookiePolicy/src/CookiePolicyMiddleware.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ namespace Microsoft.AspNetCore.CookiePolicy;
1313
/// <summary>
1414
/// Initializes a new instance of <see cref="CookiePolicyMiddleware"/>.
1515
/// </summary>
16+
/// <remarks>
17+
/// When using <see cref="CookieOptions"/> to configure cookies, note that a
18+
/// <see cref="CookieOptions"/> instance is intended to govern the behavior of an individual cookie.
19+
/// Reusing the same <see cref="CookieOptions"/> instance across multiple cookies can lead to unintended
20+
/// consequences, such as modifications affecting multiple cookies. We recommend instantiating a new
21+
/// <see cref="CookieOptions"/> object for each cookie to ensure that the configuration is applied
22+
/// independently.
23+
/// </remarks>
1624
public class CookiePolicyMiddleware
1725
{
1826
private readonly RequestDelegate _next;

0 commit comments

Comments
 (0)