Last post Mar 29, 2016 07:00 AM by Srikanth Varma
Mar 12, 2016 10:07 AM|Srikanth Varma|LINK
event (in Global.asax.cs ) triggered. Here i will extract the info from cookie (Using Request.Cookies["CookieName"]) and validate the user data.
Now the issue is Request.Cookies["CookieName"] results old cookie instead of the new one that was written in the Signin.aspx. This issue occurs once in around 5-10 trails and not consistent. Can anyone help me with this.
Mar 14, 2016 06:40 AM|Candice Zhou|LINK
Welcome to ASP.NET Forums!
You can direct the user's browser to delete the cookie by setting the cookie's expiration date to a past date. The next time a user makes a request to a page within the domain or path that set the cookie, the browser will determine that the cookie has expired
and remove it, like below:
if (Request.Cookies["UserSettings"] != null)
HttpCookie myCookie = new HttpCookie("UserSettings");
myCookie.Expires = DateTime.Now.AddDays(-1);
Please see: https://msdn.microsoft.com/en-us/library/ms178195.aspx
Mar 14, 2016 04:32 PM|Srikanth Varma|LINK
I put the same code before adding cookie to response. But issue is still exists. As I told you issue comes randomly. I get old cookie if cookie already present else null.
Mar 16, 2016 10:14 AM|Candice Zhou|LINK
I think you could set original Cookies to be null before executing, then assign the Cookie as you want.
Mar 29, 2016 07:00 AM|Srikanth Varma|LINK
I have wrong JS code in signin button click, which calls signin function twice for single enter key stroke. Problem solved. Thanks for the inputs.