Session State in User Controls in Wizard Control

L

Larry R

I have a wizard control that has a varying number of steps.
Each step utilizes different custom business objects and populates
values.
The steps are partially determined at the beginning of the wizard.
Imagine a reporting wizard where you grab all of the parameters for a
report.

So, each of the steps are in a separate user control. The user control
loads the appropriate objects from session controlled by properties on
the control similar to this:
public ReportManager Manager
{
get
{
ReportManager manager = null;
try
{
manager = (ReportManager)Session["Manager"];
}
catch { }
if (manager != null)
return (ReportManager)manager;
else
return null;
}
set
{
Session["Manager"] = value;

}
}

The problem that I am having is that when I get to the Summary page,
all of my variables that have been put into session state are null (or
empty). Even simple bool or string variables.

Session is set to inproc, 20 min, and when stepping through the code,
I see the values being populated. It is like when it goes to the next
step, the session goes away. There is no app pool recycle or things
like that going on.

I do notice that the summary control get's loaded on each and every
step. I don;t know why that would cause any issue though.

I know this is a little hard without seeing the code, but it would be
a lot. On each control, I set the OnInit() to
Page.RequiresControlState(this);
base.OnInit(e);
and
protected override void OnUnload(EventArgs e)
{
SaveViewState();
SaveControlState();
base.OnUnload(e);
}
to make sure that some other state issues happen correctly.
These are .ascx User controls.

I am looking for overall suggestions on how to handle this. I have
thought about refactoring to move all of the different BO and props
into a single object and load/save that out. I have even thought about
serializing this out to a DB or using SQLSessionState, but those are
all a lot of work, and of course, not a lotta time.

Anyone care to offer suggestions ?
 

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

No members online now.

Forum statistics

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

Latest Threads

Top