Session variables

  • Thread starter Thread starter Marine
  • Start date Start date
M

Marine

Hi,

Is there any inconvenient using session variables (about 10, containing
string), for a website having about 100 simultaneous users ?

Thanks for your opinion !
 
That's a pretty frugal use. ( 100 x 10 )

My only comment would be.... do these values have anything in common?
Or are they disjoint?

If some of them are in common...then you might want to create a small
wrapper object, and put that into the session, instead of a bunch of
disjoint values.

public class EmployeeStuff
string FavoriteColor (encapsulated as a property)
string JobTitle(encapsulated as a property)
string CubicleNumber (encapsulated as a property)


Session["CurrentEmployee"] = new EmployeeStuff(); //Put an item into the
Session

EmployeeStuff es = Session["CurrentEmployee"] as EmployeeStuff;//put if out
of the Session


Create a little wrapper object (as above), and put that into session instead
of disjointed things like this:

Session["CurrentEmployeeFavoriteColor"]
Session["CurrentEmployeeJobTitle"]
Session["CurrentEmployeeCubicleNumber"]

Aka, that's kind sloppy.


Using the small wrapper class will greatly help with debugging and
maintenance.



You can check this out as well:
http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!151.entry
 
It depends on how big the string are and how much RAM you have.
It can be a problem, but again depends.

Wrapping in one object might be less overhead?
 
Back
Top