Adding a title to the added content adds a second empty title tag

My main page has the content owner in the main tag.

Since I want the page title to display the function of the current page, and because I want the title to be translated into a custom language, I added the title tag as the owner of the page content. All are funny and good, except that now a second empty title tag appears, which is not true.

Any ideas how to solve this?

+5
source share
6 answers

, , , . , . , runat = "server", false:

<title visible="false" runat="server"><%-- hack to turn the auto title off --%></title>
+4

W3C:

HTML TITLE HEAD.

, ASP.Net , - ​​ , .

ASP.Net :

  • @page
  • Page.Title , .

ASP.Net MVC, Site.Master :

<title><%= Html.Encode(ViewData["Title"]) %></title>

:

ViewData["Title"] = "Home";

, .

, HeadContent CSS.

+6
+2

@Page Title . .

.

, ASP.NET MasterPages. ASP.NET MVC.

0

runat = "server" masterpages

0

, - attritube :

<%@ Page Title="PAGE NAME HERE" Language="C#" MasterPageFile="~/Controls/MasterPage/MasterPage.master"
AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>

page_load

Page.Title = "Your page title"

, .

0

All Articles