ASP.NET - What Happens When an HttpCookie Expires

I create several cookies in my ASP.NET application. These cookies expire 10 minutes after they are created. I follow the approach described in MSDN as shown below: http://msdn.microsoft.com/en-us/library/system.web.httpcookie.expires.aspx

My question is: when a cookie expires, what happens? Does the browser automatically delete the cookie? Is it our responsibility for developers to delete cookies if they exist and expire?

Thank,

+3
source share
3 answers

Is the cookie browser automatically deleted?

Yes - or earlier if the user wants.

cookie, ?

-

+3

, .

+1

You should not rely on the browser to delete old cookies. The browser will delete cookies by comparing the expiration date with the client, not the server. Therefore, if you install the expiration servers within 30 minutes, but the client has a one-year clock behind, then the client browser will not delete the cookie for another year and 30 minutes.

Before authorizing a request, always check the expiration servers.

0
source

Source: https://habr.com/ru/post/1738658/


All Articles