Are cookies supposed to work like this
March 1st, 2007
Recently at work, I had to fix some code that checks a cookie in C#. The cookie could either be in the response (preferred)or request. The problem was that checking the response cookie when it isn’t set would actually set it to null. This was bad.
I know there must be some way to check the cookie without setting it, but I couldn’t find it, so I ended up with something like this:
Of course, this isn’t quite right because it’s from memory. But I feel like this is a WTF - it’s an ugly workaround of something that should be a one-liner.