Forum Moderators: open

Message Too Old, No Replies

Sessions or Requeries?

which is less stress

         

txbakers

5:37 pm on Jan 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On a welcome page I run a query to test for expiration date of their account and indicate it.

I would like to show some type of status on every page they visit, and I have two choices - make a Session variable for the status and reference it on every screen, or run a query on every screen to check for it.

Both aren't great solutions. The constant query can affect DB performance, the constant Session affects the server performance.

So, which is the preferred method?

Easy_Coder

6:43 pm on Jan 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



option 3
look it up once and stuff it in a cookie?

mattglet

8:18 pm on Jan 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I would use option 1. A simple query once a page will be fine.

aspdaddy

9:15 pm on Jan 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there any difference in session and cookie?, sessions are implemented using a cookie after all.

I do the session, its only text data, I put a custom sessionStart() function in that pulls the user profile and creates a load of session variables.

Another option is to pass it around every page in a form or querystring (M$ rep told me there is a setting in IIS6 or .NET somewhere to "session-mung all querstrings" like amazon/hotmail do and even works when load balancing over multiple servers unlike normal sessions)

TheNige

8:03 pm on Jan 18, 2006 (gmt 0)

10+ Year Member



Are you using .Net or classic ASP? If .Net another option is to use the cache instead of session. You can set the cache to expire when you want it and even have it on a sliding expiration so if it doesn't get used it will expire. If the server starts to need memory it will start dumping things from cache.

mrMister

10:36 pm on Jan 18, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there any difference in session and cookie?, sessions are implemented using a cookie after all.

A session uses a cookie as a unique identifier. That identifier references data stored in memory on the server. You can use the cookie to store the data on the users machine rather than using up server memory.