SessionState Variables lost

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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.
 
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

Back
Top