Untuk melakukan override Page Title pada ASP.NET dapat dilakukan dengan beberapa cara

Melalui File *.aspx

Pada file MasterPage.Master

Kemudian pada file page Content *.aspx
<%@ Page Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
Title="" CodeBehind="MyFile.aspx.cs" Inherits="Generate Default Namespace" %>

Melalui Code Behind

Umumnya file *.aspx memiliki kerangka seperti ini:

Kemudian pada file *.CS (MyFile.aspx.cs) , bisa menggunakan shortcut F7 untuk beralih ke halaman code behind.

Cara 1: Menambahkan method OnLoad

protected override void OnLoad(EventArgs e)
{
	Page.Title = "Your Title";
	base.OnLoad(e);
}

Cara 2: Menggunakan BasePage

public class BasePage : System.Web.UI.Page {
	public void setPageTitle(string _pageTitle)
	{
		Page.Title = _pageTitle;
	}
}

public partial class MyFile : BasePage {
	protected void Page_Load(object sender, EventArgs e)
	{
		this.setPageTitle("New Page Title");
	}
}

Pranala Luar

  1. https://stackoverflow.com/questions/21617855/set-page-title-on-asp-content-where-it-uses-master-page
  2. https://stackoverflow.com/questions/7724122/extend-masterpage-class-in-child-page
  3. https://docs.microsoft.com/en-us/aspnet/web-forms/overview/older-versions-getting-started/master-pages/specifying-the-title-meta-tags-and-other-html-headers-in-the-master-page-cs
  4. https://www.oreilly.com/library/view/aspnet-20-cookbook/0596100647/ch01s03.html
  5. https://www.c-sharpcorner.com/article/get-master-page-control-value-in-content-page/
https://rankmath.com/wordpress/plugin/seo-suite/?ref=suhendrayohanaputra&campaign=SYPWebsite