If I add a cookie to the response via Response.Cookies.Add()
, the cookie will also appear in Request.Cookies
.
Is there a way to get the original request cookies (ignoring recently added cookie responses) without first caching Request.Cookies
in advance?
There is another question that asks why this situation exists (the point I'm talking about). I ask if there is any way there.
Update
As a very crude filter, you can search for cookies in Request.Cookies
whose Expires
is equal to default(DateTime)
. This is because when browsers serialize their cookies in a request, they do not include their expiration dates.
However, this will not save you any cookies accidentally added to Response
without Expires
.
source share