SessionState Variables lost

G

Guest

Hi everyone hopefully you can help me figure this one out.

I have a datalist that load its itemTemple (ITemplate) form an existing user
control. Now this usercontrol needs to access a sessionState variable when it
is loading. For some reason I get a System.NullReferenceException, It says
that there is no instance of the session object. Why would this be???

Thanks.
 
J

Joe Fallon

One reason is if you set EnableSessionState=False in the @Page declaration.

Another reason could be that you use InProc session state and the process
got recycyled.
 
R

Rick Spiewak

You may need to pass your user control a reference to the page, and let it
get at the session object that way.
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top