If I add a cookie to the response via Response.Cookies.Add()
, the cookie also appears in Request.Cookies
.
Is there any way to get to the original request cookies (ignoring newly added response cookies) without somehow caching Request.Cookies
in advance?
There is another question that asks why this situation exists (a point that I'm clear on). I'm asking if there's any way around it.
Update
As a very rough filter, it seems you can look for cookies in Request.Cookies
whose Expires
is equal to default(DateTime)
. This is because when browsers serialize their cookies in the request, they don't include their expiration dates.
However, this wouldn't get rid of any cookies accidentally added to Response
without an Expires
.