ASP.NET MasterPageFile Error

I am trying to use the homepage on my website. I created a page and then created a wizard. Then I added the tag MasterPageFile = "~ / master". I assume that I need to do something on my main page, because now I started to get the error:

The page contains markup that is not valid when attached to a master page

My main page is as follows:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" MasterPageFile="~/my.master" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<body>
     <form id="form1" runat="server">
     <div>

     </div>
     </form>
</body>
</html>

I tried to remove the tag, thinking that this could be a problem. Can someone point me in the right direction?

+3
source share
2 answers

body content. contentplaceholders: . . msdn .

, :

<td><asp:contentplaceholder id="Main" runat="server" /></td>

,

<% @ Page Language="C#" MasterPageFile="~/Master.master" Title="Content Page 1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server">
    Main content.
</asp:Content>

, .

+5

, , <asp:Content . , html- doctype ..

+1

Source: https://habr.com/ru/post/1759313/


All Articles