VS 2005. Например, просто - создаю страницу .aspx и мастер пейдж страницу. В .aspx указываю страницу .master в директиве @Page ... MasterPageFile="~/...". И получаю такую ошибку при попытке открыть в броузере
Content controls have to be top-level controls in a content page or a nested master page that references a master page. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Content controls have to be top-level controls in a content page or a nested master page that references a master page.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Content controls have to be top-level controls in a content page or a nested master page that references a master page.
А на странице .aspx на странице кода у тега
html xmlns="http://www.w3.org/1999/xhtml" >
html
Получаю ошибку :
Error 1 Validation (XHTML 1.0 Transitional): Content is not supported outside 'script' or 'asp:content' regions. E:\...\WebSite\
Что-то я не соображу что к чему. Ничего дополнительного не делал - просто создал страницу и мастер-страницу, добавил к первой вторую и всё. Что хоть не так то ?
В аттаче рабочий пример.
Да не мудрил я там ничего. Когда добавляешь .master страницу к .aspx необходимо кроме указания аттрибута MasterPageFile ещё кое-что подправить руками. Если при создании страницы в визарде указать на выбор страницы .master, все делается автоматически.