将元标记添加到.aspx页面

时间:2013-09-30 13:25:05

标签: asp.net metadata

我是ASP的新手,但我被要求查看我们的网站,并确定如何为基于ASP的网站添加唯一的描述和关键字元标记。目前,该网站对每个网页都使用相同的网站,这对Google搜索结果非常不利。

其中一个aspx页面中的代码说:

{<%@ Page MasterPageFile="~/Master/Default.Master" Language="c#" ContentType="text/html" CodeBehind="FundRaising.aspx.cs" AutoEventWireup="false" Inherits="Company.FundRaising" ValidateRequest="false" %> <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="cphContent">
    <div id="div-content" class="bgButterfly">
        <capris:StaticPage id="StaticPage1" runat="server" StaticPageId="11">No content available</capris:StaticPage>
    </div></asp:Content>}

(我将公司名称替换​​为上面的“公司”一词。)

现在有一个名为Head.ascx的文件,其中包含通用元标记。

目录中没有.aspx.cs文件,因此必须将其预编译为.dll文件。

在不影响网站功能的情况下,我是否可以在每个页面的头部添加唯一的描述和关键字元标记?

提前致谢。

1 个答案:

答案 0 :(得分:1)

您可以将控件添加到主页面,在每个子页面/用户控件中,您可以在主页面中搜索该控件。

e.g 在母版页(或其他形式)

<asp:Literal id="lcGoogleinfo" runat=server></asp:Literal>

以子形式:

Literal lcGoogleinfo= (Literal)Master.FindControl("lcGoogleinfo");
相关问题