Thursday, March 22, 2012

Session variables

Hi,
Is there any inconvenient using session variables (about 10, containing
string), for a website having about 100 simultaneous users ?
Thanks for your opinion !"Marine" <none@.none.org> wrote in message
news:eTeoALWJIHA.4684@.TK2MSFTNGP06.phx.gbl...

> Is there any inconvenient using session variables (about 10, containing
> string), for a website having about 100 simultaneous users ?
IMO, no...
Mark Rae
ASP.NET MVP
http://www.markrae.net
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
"Marine" <none@.none.org> wrote in message
news:eTeoALWJIHA.4684@.TK2MSFTNGP06.phx.gbl...
> Hi,
> Is there any inconvenient using session variables (about 10, containing
> string), for a website having about 100 simultaneous users ?
> Thanks for your opinion !
>
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?
"Marine" <none@.none.org> wrote in message
news:eTeoALWJIHA.4684@.TK2MSFTNGP06.phx.gbl...
> Hi,
> Is there any inconvenient using session variables (about 10, containing
> string), for a website having about 100 simultaneous users ?
> Thanks for your opinion !
>

0 comments:

Post a Comment