tags:

views:

55

answers:

1

I have 2 aspx pages. Both of them use the same MasterPage and both of them inherit from the same base class 'BasePage' which is of type System.Web.UI.Page. I overrode the SqlPagePersister property on the BasePage. For 1 page this works fine, for the other it doesn't. The sequence of events im seeing is this:

Page A:

  • MasterPage Init
  • Page Load
  • Retrieval of SqlPagePersister Property

Page B:

  • Retrieval of SqlPagePersister Property
  • MasterPage Init
  • Page Load

Why would 2 pages with an identical set up call these methods out of order and what can be done to fix this?

A: 

The sequence of events for Page B can't happen in the life cycle of an ASP.Net page. The master page init and page load must be in a state of being "re-fired". You may want to look at any previous page action that is being shunted into Page B because the init/load must happen before the retrieval can even begin.

There must be some action happening before Page B property retrieval, but that doesn't mean you're going to catch it necessarily in your debug with your normal casual breakpoints. You may have to get creative and start at the PreInit of your base class.

Joel Etherton

related questions