Use UnixEpoch for cookie deletion (#18126)

Use the DateTimeOffset.UnixEpoch field instead of a new DateTime value when deleting cookies.
This commit is contained in:
Martin Costello 2020-01-04 20:39:54 +00:00 committed by Chris Ross
parent c802134737
commit b6b5319bab
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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,
});
}