Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

working with cookies

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
Can you write cookies in ASP.NET that can be read by a ASP page, and how would you write it so it was deleted once the browser was closed???
 
A cookie is a cookie is a cookie.

As long as the code from asp or asp.net knew what to look for in that cookie, it shouldn't matter.

I'm not sure about the browser closing thing (I'm sure someone here does), but you could just set the lifetime of the cookie to be something like an hour or so, assuming you knew that most users wouldn't be hanging around that long (1/2 hour might even be doable).

Jack
 
that is the answer I was looking for. How would you expire a cookie after 1 hour? Also if you try to create a new cookie with the same name does it override the old info??
 
The cookie has a Cookie.Expires property that you can set in the code behind.

In our code, we checked if the cookie existed. If it didn't, we wrote a new one. If it did, we just got the existing and appended the timeout.

Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top