Session Cookies

Results 1 to 8 of 8

Thread: Session Cookies

  1. #1
    Dayna Guest

    Default Session Cookies

    Hi,<BR><BR>I&#039;ve been reading about using Session cookies to store a users id number once they have logged in.<BR><BR>This seems like a really useful way to manage State in between client requests.<BR><BR>Are there any other examples of where it is good to use Session variables to store values, or is it always better to hit the database for information?<BR><BR>Thankyou,<BR>Dayna

  2. #2
    Join Date
    Dec 1969

    Default It all depends..

    ..session could be a good way to transfer info from one page to other and throughout the site, it could be used as a security feature but then again if your site gets a lot of hits daily say in thousands then may be this is not the best way to go, it takes a lot of memory and also if a user has turned ""off"" cookies at his machine, session variables wont work.

  3. #3
    Dayna Guest

    Default RE: On what....

    You say that they take a lot of memory, but what about the processor resources of hitting the database millions of times compared with just reading out of a session value? Couldn&#039;t that save time on a heavily hit site?

  4. #4
    RDM Guest

    Default Rule of thumb...

    ...Always take a hard look at the number of bytes you expect to store in memory with Session variables. If 80-90 percent of your pages only reference say the UserID, Name, and maybe email, then go ahead store these in Session. However, you wouldn&#039;t want to put other extraneous data that is not used on a huge percentage of the pages.<BR><BR># bytes used * # of simultaneous users = memory used<BR>

  5. #5
    Dayna Guest

    Default I'm all thumbs.

    But is it cheaper to store the Name and maybe email in session than to query them from the database? I&#039;ve already got a handle to an open connection to the database.

  6. #6
    RDM Guest

    Default Yep...

    ...It sure is. If your site never has the possible of being apart of a large scale web farm, then Sessions are fine for this. <BR><BR>And if you are storing your ADO connection object in a Session variable, stop it now. That&#039;s a huge no no. Here&#039;s why:<BR><BR>It&#039;s an article on ADO connection performance with queries.

  7. #7
    Dayna Guest

    Default RE: Yep...

    Perfect, thankyou for your help.

  8. #8
    RDM Guest

    Default You bet...Take care.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts