From b6b5319bab88e4e665e2c4d750017f5c6ef93a37 Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Sat, 4 Jan 2020 20:39:54 +0000 Subject: [PATCH] Use UnixEpoch for cookie deletion (#18126) Use the DateTimeOffset.UnixEpoch field instead of a new DateTime value when deleting cookies. --- src/Http/Http/src/Internal/ResponseCookies.cs | 2 +- src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Http/Http/src/Internal/ResponseCookies.cs b/src/Http/Http/src/Internal/ResponseCookies.cs index a8ed7dd66f..571df1068c 100644 --- a/src/Http/Http/src/Internal/ResponseCookies.cs +++ b/src/Http/Http/src/Internal/ResponseCookies.cs @@ -129,7 +129,7 @@ namespace Microsoft.AspNetCore.Http { Path = options.Path, Domain = options.Domain, - Expires = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc), + Expires = DateTimeOffset.UnixEpoch, Secure = options.Secure, HttpOnly = options.HttpOnly, SameSite = options.SameSite diff --git a/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs b/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs index 4f1700bb77..098e3d6690 100644 --- a/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs +++ b/src/Shared/ChunkingCookieManager/ChunkingCookieManager.cs @@ -288,7 +288,7 @@ namespace Microsoft.AspNetCore.Internal SameSite = options.SameSite, Secure = options.Secure, IsEssential = options.IsEssential, - Expires = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc), + Expires = DateTimeOffset.UnixEpoch, HttpOnly = options.HttpOnly, }); @@ -305,7 +305,7 @@ namespace Microsoft.AspNetCore.Internal SameSite = options.SameSite, Secure = options.Secure, IsEssential = options.IsEssential, - Expires = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc), + Expires = DateTimeOffset.UnixEpoch, HttpOnly = options.HttpOnly, }); }