Override existing list of master pages?

  • Thread starter Thread starter Greg Collins [Microsoft MVP]
  • Start date Start date
G

Greg Collins [Microsoft MVP]

I have a situation where a particular error page is being redirected to (Server.Transfer) and in most cases it works correctly loading the correct master page and rendering as it should.

In another case, this page is being called as a result of an asp:Xml failure, but the Server.Transfer seems to maintain the existing hierarchy of master pages, and thus the page is framed twice when rendered. (Response.Redirect actually works correctly here but causes other issues I don't have time to get into).

So I normally get (as I should):

Master1/ErrorPage

But sometimes I get:

Master1/Master2/Master1/ErrorPAge

So my question is, how can I clear the existing hierrachy of master pages to have just Master1 when the error page is loaded?
 
I think I might have found a solution for this:

In the OnPreInit() handler I start with: Response.Clear();

If you can think of a reason why this is bad, please let me know. If I find that it doesn't work right, I'll report back.

Thanks.
 
Back
Top