Connecting Tech Pros Worldwide Forums | Help | Site Map

Simple Question - How do I capture Page.Request before Page_Load

malcolm
Guest
 
Posts: n/a
#1: Nov 18 '05
Inside of a Page class, how do I capture the Request object values
before the Page_Load event is called of that Page? I have a situation
where I have many server controls on a Page that get created in the
constructor of my Page, but I need them to know about some info that
get's set via the Page_Load from the Request (and even Session for
that matter)

thanks!
Dave
GrantMagic
Guest
 
Posts: n/a
#2: Nov 18 '05

re: Simple Question - How do I capture Page.Request before Page_Load


Are you looking for Page_Init?

void Page_Init(Object sender, EventArgs e)
{
//Pre page load requests here
}

"malcolm" <chakachimp@yahoo.com> wrote in message
news:4fe7c9e8.0409150023.1ff12291@posting.google.c om...[color=blue]
> Inside of a Page class, how do I capture the Request object values
> before the Page_Load event is called of that Page? I have a situation
> where I have many server controls on a Page that get created in the
> constructor of my Page, but I need them to know about some info that
> get's set via the Page_Load from the Request (and even Session for
> that matter)
>
> thanks!
> Dave[/color]


malcolm
Guest
 
Posts: n/a
#3: Nov 18 '05

re: Simple Question - How do I capture Page.Request before Page_Load


If I'm not mistaken, during the Page_Init, I don't have access to the
Request.Form, Request.QueryString or Viewstate even because they are
not loaded yet. I'm just new and trying to learn about the Page
Lifecycle. What I should be doing (I think) is trapping the button
click event and put my logic there. I think the button click event is
raised on the server before the Page_Load, but after everything is
loaded which is what I want. Further, this is ASP.NET's whole point I
think, that is, to make everything behave like a "Client-Server" app.

Anyway, I'm simply trying to write a Login and Logoff component (which
every ASP.NET developer ends up writing as an exercise early on I'm
sure) and I'm learning the hard way what Page LifeCycle means and
such. I've since read, in fact, that it's not good to directly access
the Page.Request or Page.Form anymore. Instead, it's good to override
methods that are part of the Page Lifecycle. I'm still learning I
guess!

Thanks,
Dave

"GrantMagic" <grant@magicalia.com> wrote in message news:<#AEyDWwmEHA.2948@TK2MSFTNGP11.phx.gbl>...[color=blue]
> Are you looking for Page_Init?
>
> void Page_Init(Object sender, EventArgs e)
> {
> //Pre page load requests here
> }
>
> "malcolm" <chakachimp@yahoo.com> wrote in message
> news:4fe7c9e8.0409150023.1ff12291@posting.google.c om...[color=green]
> > Inside of a Page class, how do I capture the Request object values
> > before the Page_Load event is called of that Page? I have a situation
> > where I have many server controls on a Page that get created in the
> > constructor of my Page, but I need them to know about some info that
> > get's set via the Page_Load from the Request (and even Session for
> > that matter)
> >
> > thanks!
> > Dave[/color][/color]
Girish Bharadwaj
Guest
 
Posts: n/a
#4: Nov 18 '05

re: Simple Question - How do I capture Page.Request before Page_Load


If you really want to tap into that stuff after Init but before Page_Load(),
you can implement IPostBackDataHandler (in a web control, I am not sure if
you can do that with a Page control itself) and wait for a call from the
runtime which will call a LoadPostData which gives you a chance to see all
that.
Or you can write a HTTP module to that.

--
Girish Bharadwaj
http://msmvps.com/gbvb
"malcolm" <chakachimp@yahoo.com> wrote in message
news:4fe7c9e8.0409240538.27e8942d@posting.google.c om...[color=blue]
> If I'm not mistaken, during the Page_Init, I don't have access to the
> Request.Form, Request.QueryString or Viewstate even because they are
> not loaded yet. I'm just new and trying to learn about the Page
> Lifecycle. What I should be doing (I think) is trapping the button
> click event and put my logic there. I think the button click event is
> raised on the server before the Page_Load, but after everything is
> loaded which is what I want. Further, this is ASP.NET's whole point I
> think, that is, to make everything behave like a "Client-Server" app.
>
> Anyway, I'm simply trying to write a Login and Logoff component (which
> every ASP.NET developer ends up writing as an exercise early on I'm
> sure) and I'm learning the hard way what Page LifeCycle means and
> such. I've since read, in fact, that it's not good to directly access
> the Page.Request or Page.Form anymore. Instead, it's good to override
> methods that are part of the Page Lifecycle. I'm still learning I
> guess!
>
> Thanks,
> Dave
>
> "GrantMagic" <grant@magicalia.com> wrote in message[/color]
news:<#AEyDWwmEHA.2948@TK2MSFTNGP11.phx.gbl>...[color=blue][color=green]
> > Are you looking for Page_Init?
> >
> > void Page_Init(Object sender, EventArgs e)
> > {
> > //Pre page load requests here
> > }
> >
> > "malcolm" <chakachimp@yahoo.com> wrote in message
> > news:4fe7c9e8.0409150023.1ff12291@posting.google.c om...[color=darkred]
> > > Inside of a Page class, how do I capture the Request object values
> > > before the Page_Load event is called of that Page? I have a situation
> > > where I have many server controls on a Page that get created in the
> > > constructor of my Page, but I need them to know about some info that
> > > get's set via the Page_Load from the Request (and even Session for
> > > that matter)
> > >
> > > thanks!
> > > Dave[/color][/color][/color]


Closed Thread