News:

Tekforums.net - The improved home of Tekforums! :D

Main Menu

Cookies

Started by FuMaN, June 17, 2006, 15:29:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

FuMaN

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.

DeltaZero

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)

FuMaN

The reason for the move is because sessions expire after 20 minutes and for what Im doing I dont want this to occur.

DeltaZero

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.