Page.MetaDescription 屬性

定義

取得或設定 "description" meta 項目的內容。

public:
 property System::String ^ MetaDescription { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Bindable(true)]
public string MetaDescription { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.MetaDescription : string with get, set
Public Property MetaDescription As String

屬性值

String

"description" meta 項目的內容。

屬性

例外狀況

頁面沒有標頭控制項 (head 屬性設為「server」的 runat 項目)。

範例

如果您將 MetaDescription 頁面的 屬性設定為 「ASP.NET Overview」,下列元素會出現在轉譯的 HTML 中:

<meta name="description" content="ASP.NET Overview" />

備註

HTML meta 元素可用來改善搜尋引擎清單。 某些搜尋引擎會使用 「description」 meta 元素來改善清單預覽。

如果頁面標記的 元素中 head 沒有 「description」 meta 元素,則會 meta 在轉譯頁面時將元素新增至頁面。 如果頁面標記已經有 「description」 meta 元素,這個屬性會取得或設定 content 專案的 屬性 meta

您也可以在 @ Page 指示詞中設定此屬性。

適用於

另請參閱