Categories
.NET ASP.NET C#.NET VB.NET/VB

ASP.NET: Why my cookie is not saving

Funny, today after years I thought to finally use Cookies in one of my project. It is probably my first attempt to use Cookie in ASP.NET in last 5 yrs. WOW, that is amazing. Anyways, I just notice one thing and thought it might help any first timer, so here is the key note I want to share. In ASP.NET if you want to read Cookie, use REQUEST.Cookies, but if you want to add new Cookie use RESPONSE.Cookies. This is very minor difference and I really waste 30 minutes before I release I was using Request.Cookies to add new cookie, but it won’t get added that way.

By Sumit Gupta

Sumit Gupta, born on 7th Feb 1981 in NCR, India. He lives a quiet life until he turn to a developer. Once he is in his professional life people start recognizing him for his work. Sumit Gupta is always keen to learn more and share his knowledge to anyone who deserve it. His goal of life is to code at least one 3D action game by itself or with his company Vikasumit [http://www.vikasumit.com].