问题
Im working on an edit/display mode switch of MasterPage and PageLayout. I asked a question on this before (How to dynamically switch PageLayout and MasterPage of SharePoint Publishing page?). The nicest approach seems to be a HttpModule where to switch MasterPage and PageLayout to edit specific variants. MasterPage switching is no problem, but the PageLayout switching results in an error.
回答1:
I found the definitive answer! Its all working now! Problem was that after publish the wrong item is cached. I flushed the item from the cache and it all works now. Also did a lot of rewriting on the code. I am now creating a WSP package for it with an activation feature, preparing the code for publication on codeplex. I will update this post as soon as the code is published.
回答2:
I found the solution. I have to update the list item, otherwise the url exeception occures. It isn't like the temporary updating the master url in the web, I have to update the list item. Doesn't really matter, there is a good SystemUpdate(false) variant that makes no versions. I did huge rewrites, but still did not get it completely working again. Sometimes the edit mode still uses the display pagelayout, and I just can't find out why. Does anyone dare to helpme debugging this. If it works we have something interesting I think. Full seperation of Edit and Display masterpages and pagelayouts. The strange thing is that the used pagelayout is lagging behind. I get sometimes a display pagelayout in edit mode, and an edit pagelayout in display mode.
来源:https://stackoverflow.com/questions/991743/sharepoint-temporary-switching-pagelayout-of-publishingpage-in-httpmodule-fails