468,119 Members | 1,912 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,119 developers. It's quick & easy.

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

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
Nov 18 '05 #1
3 1827
Are you looking for Page_Init?

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

"malcolm" <ch********@yahoo.com> wrote in message
news:4f**************************@posting.google.c om...
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

Nov 18 '05 #2
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" <gr***@magicalia.com> wrote in message news:<#A**************@TK2MSFTNGP11.phx.gbl>...
Are you looking for Page_Init?

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

"malcolm" <ch********@yahoo.com> wrote in message
news:4f**************************@posting.google.c om...
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

Nov 18 '05 #3
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" <ch********@yahoo.com> wrote in message
news:4f**************************@posting.google.c om...
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" <gr***@magicalia.com> wrote in message

news:<#A**************@TK2MSFTNGP11.phx.gbl>...
Are you looking for Page_Init?

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

"malcolm" <ch********@yahoo.com> wrote in message
news:4f**************************@posting.google.c om...
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

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Ming Zhu | last post: by
1 post views Thread by Matthew Wieder | last post: by
6 posts views Thread by MooreSmnith | last post: by
reply views Thread by Goober at christianDOTnet | last post: by
1 post views Thread by spammy | last post: by
2 posts views Thread by Ralph Krausse | last post: by
19 posts views Thread by Joe | last post: by
15 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.