I have a website that can be accessed from www.blahblah.com and special.blahblah.com. The www site always works but occasionly I get a 'Content controls have to be top-level controls in a content page or a nested master page that references a master page' error on the special site.
It's exactly the same code running in both situations and the offending page doesn't even have a master page. Why would it work all the time on one and fail sometimes on the other?
If anyone gets this error message when dynamically switching master pages, make sure your code is
MasterPageFile = "TheMasterPage.master"
Not
this.master.MasterPageFile = "TheMasterPage.master"
Just got this problem. It was because we had a tag ending with double slashes:
<//asp:HyperLink>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With