Override session object?

J

Jim Corey

I've just learned that the app I've been working on is
going to be deployed to a web farm.

The app uses session variables, and I've been told that I want to use
some other technique.

I was wondering if there is a way to override the session object so that
I could leave most of the current code intact. Then
for the time being I could do what I want in this override section of
code.

I only have one page in the app, and this inherits from a base page.

TIA,
Jim
 
K

Kevin Spencer

Use SQL Server to store Session data. The same SQL Server can be assigned
for all machines in the Web Farm, and you won't have any issues except for
possible serialization issues with some of the stuff you're storing. When
using SQL Server to store Sessions, all Session objects must be
serializable.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
J

John Saunders

When Kevin says, "use SQL Server", he means that you should set
<sessionState mode="SQLServer" /> in your web.config.
 
J

Jim Corey

Well, my intention is not to use sqlserver.
Evidently the explanation here means that I could go to sqlserver
without changing the code.

But I was hoping that I could write my own code to override
the session object and then save the variables to viewstate or a hidden
html field in the new code for the override and
leave the rest of the code intact.

Jim
 
J

John Saunders

Jim Corey said:
Well, my intention is not to use sqlserver.
Evidently the explanation here means that I could go to sqlserver
without changing the code.

But I was hoping that I could write my own code to override
the session object and then save the variables to viewstate or a hidden
html field in the new code for the override and
leave the rest of the code intact.

I'm sure you could do this, but why reinvent the wheel? Microsoft has
already invented a variety of wheels, and they test them, too!
 
K

Kevin Spencer

In addition to John's excellent advice, a good rule of thumb is, let
Microsoft manage as much of your stack as possible. Whatever part of your
stack you build, you have to manage. Whatever part of your stack Microsoft
builds, they have to manage.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top