one other link http://www.wisegeek.com/wh
basically if the expiration is set, the browser holds the cookie in memory rather than on the hard dick it appears
Main Topics
Browse All TopicsHello
I think I've confused myself here. I have read that asp.net creates cookies as temporary cookies if you don't set the expiry time. How then, can you have a tempoary cookie that expires after an hour. I know this is possible but it would seem to me that by setting the expiry time for an hour you are making the cookie permanent not temporary?
also, how do browsers distringuish between temp and perm cookies? How do they know when to keep the cookie on closure or to delete it. There must be some sort of flag within the cookie
thanks
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
one other link http://www.wisegeek.com/wh
basically if the expiration is set, the browser holds the cookie in memory rather than on the hard dick it appears
// c# code
// temporary cookie, dropped by browser on close
HttpCookie cookie = new HttpCookie("TestCookie");
cookie["setting1"] = "mysetting1value";
Response.Cookies.Add(cooki
// permanant cookie with expiration at 10 years from now
HttpCookie cookie = new HttpCookie("TestCookie");
cookie["setting1"] = "mysetting1value";
cookie.Expires = DateTime.Now.AddYears(10);
Response.Cookies.Add(cooki
I have found the answer elsewhere. You cannot directly create a temporary cookie with an expiry time. If you want to create a temporary cookie with an expiry time you have to store some information about expiry time in the actual cookie value. This is how the forms authentication module/forms authentication ticket works.
Thanks for your help
Ah, i dont believe what you want can be done quite in the fashion. But why would you want that, the purpose of a temporary cookie is to be destroyed after the browser closes. If you want the cookie on the browser session to expire after an hour i would do something like, create a temporary cookie and set the time the cookie was created into session at the begining of session start (or wheneer you need to set it). Then with each request to the page check to see if more than an hour as expired on the cookie.
My purpose for asking was to find out how the forms authentication ticket works because that can clearly timeout after a minute or an hour and it uses both temporary and permanent cookies. The FA ticket works as I described in my last post by setting information about the cookie expiry in the actual value part of the cookie
form authentication ticket is not quite a cookie, but can be used by one, theres a link here that describes it a bit more. Maybe that will help with what you are trying to do
http://support.microsoft.c
Business Accounts
Answer for Membership
by: wht1986Posted on 2009-04-16 at 11:54:22ID: 24161225
see this article http://tempestini.net/2007 /08/18/per manent-vs- temporary- cookies/
has a nice little write up on it, basically its just if an expires property is set it become a temp cookie