Application_PreRequestHandlerExecute and Session State not available

P

Pinku

Hi Guys,

I'm going crazy with a problem.

I have a web application that do something in
Application_PreRequestHandlerExecute, in this Method I use Session and
I have no problem about it.

I start having problem If I try to dinamically load a web user control
and add it to a controls collection of another webcontrol, for
example:

If I try to do this in Default.ASPX Page_Load:

myDiv.Controls.Add(Page.LoadControl("mycontrol.ascx"));

I obtain this exeption : "Session State not available in this context"
and debugger higlight the row in Application_PreRequestHandlerExecute
when i try to use the session.

Why this????

Until I don't load control I can access session in
Application_PreRequestHandlerExecute.

Regards

Diego
 

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,982
Messages
2,570,186
Members
46,742
Latest member
AshliMayer

Latest Threads

Top