Hi Krul,
To set a master page dynamically, you need to make sure that the code runs in the Page_PreInit event. Does the above code run in the Page_Load or Page_PreInit method?
Thanks,
Scott