I've not seen anyone say what has been my general rule, and the rule shared
by most I develop with.
Use Session for things that do not change during the session. Things like
your user name, your full name for display, etc. Same with Application level
variables (although use these VERY SPARINGLY, if at all). Just take it back
to declaring variables at the proper scope.
Beyond that if you need to get a single variable from A to B, like choosing
an item from a list to edit, just use the query string or a form post
depending on your UI.
Also, EVERY time you use a Session or Application variable be sure you
explicitly clean-up after yourself. Those I work with and I don't flog
people for using Session, but we do flog for not cleaning up after yourself.
And that goes for every level of variables not just session. So, write good
code, use intelligent practices, be consistent, and enjoy the wonders of OOP.
And remember not to take any of this too seriously, it's a job, a hobby, an
interest, and unless you are writing software that could kill a person, relax
dudez, it just isn't that big of a deal.
"Harry Simpson" wrote:
I've come from the old ASP camp where session variables were not used. When
i started using ASP.NET in 2001, I started using them again because it was
ok from what I'd read.
I've been merrily using Session variables for three years now and i'm
entering a project with my new boss who has never quite come around that
session variables are ok.
What's the concensus here. How can i convince him that they are ok in
ASP.NET. OR
Are there those out there that still think they aren't good to use?
TIA
Harry Simpson
MCSD