Context.Items from base.OnLoad

E

Eric

Hi all,

I have a web form that inherits from a base class. I try to access
Context.Items in the base class, during the Page_Load event, and find
that it is empty. When I try to access Context.Items from the derived
web form, it is populated with the value I would expect.

This creates a difficulty because I ALWAYS want to retrieve a given
value from Context.Items for all pages derived from my base class.

Why is this happening?

Is there a way to get the Context.Items value from within the base
class?

Thanks,

Eric
 
B

Brock Allen

Context.Items is a per-request state bag, so it gets recreated for every
request. Perhaps you already knew this? Anyway, it should always be available
in any request via HttpContext.Current.Items.
 

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,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top