Asp.net 2.0 Page Load sequence and SqlPagePersister property
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 开发者_C百科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?
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.
精彩评论