Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
Cookies without an expiration date expire when the browser closes. Session cookies, in opposite to other cookies, may also time out (at Session.SessionTimeout) - but that's not happening client-side, but server-side. That means IIS stops having this information stored and thus, a new Session cookie will be set when there's activity again.
So, Session cookies are client-side the same as normal cookies not having an expiration date.
You can set the expiration date with a normal cookie:
Response.Cookies("myCookie
Response.Cookies("myCookie
and delete it by:
Response.Cookies("myCookie
We call that "persistant" cookies.
If the user's browser settings don't allow cookies, Session cookies won't work, too, and a new Session cookie will be set with loading another page.
IE5 differs and lets the user choose if to allow persistant or non-persistant cookies.
As for dis-/advantages:
+ If that isn't disabled server-side, a unique SessionID will be set with a Session cookie. You can also generate one, manually, (and identify the user by that) but the IIS Session engine only recognizes its own cookies. If it's able to do so, values you store in your custom Session cookies,
Session("x") = "y"
nextpage.asp:
x = Session("x")
can be retrieved. That's just easy and comfortable.
+ If you need to store values with the user for a longer time than this browser session, you would manually set cookies with an expiration date.