In a project i had been working on i wanted to have a central MasterPageFile that had variable sub MasterPageFile’s. I finally figured out that you have to override the “OnPreInit” Event on the page you wish to modify. Here is an example:-

protected override void OnPreInit(EventArgs e)
    {
 
        if (Web_Security.IsSU())
        {
            this.MasterPageFile = "~/management/SUMasterPage.master";
        }
        else
        {
            this.MasterPageFile = "~/management/MemberMasterPage.master";
        }
        base.OnPreInit(e);
 
    }

Hope this saves you some time.