I'm currently working on the architecture for a new build of an old site.
I'm trying to avoid using session variables on the understanding that they
are the work of the devil. Having previously rolled my own session
management on other projects, I'd like to avoid all the hassle of having to
pass sessionids around on the querystring. So how does this sound for a
hybrid solution?
I'm thinking of leaving the IIS session management switched on. Let IIS hand
out a sessionid and set the cookie. I would then use this sessionid as a key
in a simple id/name/value table in a SQL Server 2000 database. Then - and
this is where it gets daft - on every page I'd load all the data into a
page-scope dictionary object. The dictionary could then be read and written
to on the page, and at the end I'd need to write it all back to the
database.When the session expires, the user gets disconnected from their
data and I can clean up the database. I will already be using a database
connection for every page.
Am I crazy?
To me this seems like a good approach if dealing with a whole stack of data
that needs to be carried in the session. However, most of the time I'm
probably looking at about half a dozen short strings. Am I just creating
something that will be less efficient than the inefficient session variables
I am trying to avoid?
Any better suggestions for replacing session variables without having to
manually carry a sessionid around the site?
Thanks!
Drew