Tekforums

Chat => Entertainment & Technology => Topic started by: FuMaN on June 17, 2006, 15:29:50 PM

Title: Cookies
Post by: FuMaN on June 17, 2006, 15:29:50 PM
Im currently developing in VB.NET and have been using Sessions but want to change to cookies. However I have no experience of using this, is it just going to be similar where I can store an object in the cookie. For example a person. Some example code would be great.
Title: Cookies
Post by: DeltaZero on June 17, 2006, 18:44:25 PM
Quote from: FuMaNIm currently developing in VB.NET and have been using Sessions but want to change to cookies. However I have no experience of using this, is it just going to be similar where I can store an object in the cookie. For example a person. Some example code would be great.

Has anything prompted this change? Ive always found sessions *much* better than cookies: If you simply want to keep data after the user has closed their web browser then Id say youd be best storing all the session data to a cookie with a save settings button somewhere on the page (or use a clientside script to do it on navigation away from page) and loading it up again at the start of the next session in a header script. Obv, youll need a session variable that youll use as a flag (maybe cookie_loaded) then your header script can simply have a line like IF cookie_loaded = false then (code to load cookie and set cookie_loaded = true)
Title: Cookies
Post by: FuMaN on June 17, 2006, 21:15:02 PM
The reason for the move is because sessions expire after 20 minutes and for what Im doing I dont want this to occur.
Title: Cookies
Post by: DeltaZero on June 17, 2006, 23:08:43 PM
You can set timeout in Web.Config. Im pretty sure theres an option to make it indefinite...which I think is by setting it to 0...but it might be -1.