What is FIRST event on Page to Calculate Session Variables?

E

Earl Teigrob

I have a small application that consists of one aspx page with inline and
dynamically loaded user and custom controls. When the page loads, I need to
calculate a set of global SESSION variables that will be used by the loaded
controls.



The problem I am having in finding a place where the session variables will
be calculated before any of the page controls or dynamically loaded controls
try to access them.



If I try to calculate the session variables in the page_load event, some of
the user controls that are on the page itself try to use these variables
before the page_load event fires. Same thing with page_init.



Two contraints I have is the need use Page.IsPostBack and
Request.QueryString



I thought maybe the application_request of the global.asax would work but
the QueryString parameters are not available yet.



So here is the question.



Can I set session variables somewhere where I can guarantee they are the
first thing that is calculated and can still access the Page.IsPostBack and
Request.QueryString members?



Thanks for your help



Earl
 
N

Natty Gur

Hi,

I cant see how user control event take place before the page OnInut. but
anyway CreateControlCollection called befor page onInit and querystring
available.

override protected System.Web.UI.ControlCollection
CreateControlCollection ()
{
object o = HttpContext.Current.Request.QueryString;
return base.CreateControlCollection();
}


Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 

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,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top