z. f. said:
Hi,
i have a class that is derived from System.Web.UI.Page, and this is the
class i use in my application as PageBase.
all other page classes are deriverd from my PageBase instead of the original
System.Web.UI.Page in order to have common checks in the page base.
i make securirty checks in the page base page_load event.
if the security fails, i can do whatever i want before the "real" / derived
page gets to be executed.
but i have noticed that the derived page load event gets to be called before
the base page load event.
so i have a problem.
i can cancel the use of page_load in my derived pages, but i use this
function to check on PostBack events that does not have server (like button)
event handler, but there when will i move it to?
is this the correct execution order - the derived gets to called before the
base?
is this also the order of execution in inheritence or only with delegated
event handlers? ( i mean when you use the syntax of Page.onLoad +=
this_onLoad )....
TIA, z.
Your classes dont work the way you would like. The ASPNET engine works with
your derived classes & calls the overriding methods in them, it couldn't
care about base classes ( I suppose it has to be System.Web.UI.Page
eventually) .
The effect you want only happens with new() where the 1st line in the
suboutine is either a call to one of the base classes constructors or an
implicit call to its parameterless constructor. So if you can put your
initialisation in the base classes new() then it should be fixed. However I
dont think all the ASP features are ready at that time, I also dont know if
any page object is reused for subsequent requests which could possibly lead
to some speedup but probably lead to hours of extra debugging. Maybe that
could be added by use of an attribute ?