mercredi 22 avril 2015

Why does MVC HttpCookieCollection.Set update the request's cookies?

I came upon this issue because I was interested in cookies that were present in an HttpRequest object, but not in the HttpResponse object. I was very confused that a cookie that my browser and Fiddler claimed were not in my request were present in my HttpRequest object. I found that an ActionFilterAttribute was setting the response's cookie. After stepping over Response.Cookies.Set I saw that Request.Cookies included the cookie that I added to the response. Long story short I decompiled the assembly and figured out that it was intentional.

My questions are:

  1. I have ideas on how to solve it, but is there already an established way around this?
  2. What was reasoning behind that decision? It seems very counterintuitive.



Aucun commentaire:

Enregistrer un commentaire