<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h3>My home page content<h3>
<p>
This is the content on my home page. This page has an appropriate title tag and
also has meta tags for keywords and description that are relative to this page.
The title tag is essential to good search engine optimization and the meta
description is the text that the search engine will display when your
page is listed in search results. The title and meta description should be
set specific to each page and should describe the content of the page.
</p>
</asp:Content>
注意这里增加了一个CodeFileBaseClass属性,这是必需的,它可以引用BasePage类的公共属性
重点提要
你应该注意到了,在BasePage类里使用了正则表达式。这是因为在你的.aspx里添加描述和关键字的时候可能会是多行,就像下面这个例子似的
<%@ Page Language="C#" MasterPageFile="~/IdeaScope.master" AutoEventWireup="true"
CodeFile="is.aspx.cs" Inherits="_is"
CodeFileBaseClass="BasePage"
Title="Effective Customer Feedback Management, Improve Customer Commmunication"
Meta_Keywords="Customer Feedback, Customer Opinion, feedback, opinion,
idea, ideas, idea management, customer feedback management,
product management, product manager, product marketing,
product marketing manager"
Meta_Description="IdeaScope is an on-demand and embedded solution that allows
you to capture, prioritize and centrally manage customer feedback. Make your
customer feedback process more efficient. Save time and involve more
stakeholders without significant cost."
%>
如果不用正则表达式转换它们的话,这些标记就会包含很多的新行和空格,这会使一些搜索引擎不知所措,所以我们要让这些标记方便搜索引擎的收录。
还有另外一个问题就是,Visual Studio 2005不认识Meta_Keywords属性和Meta_Description属性。你如果在@Page指令中指定了这两个属性的话,将会看到这些属性的下面会出现红色的波浪线,VS2005会认为它们是无效的,但实际上它仍然可以正确的编译和运行。如果你不想看到这些错误的话,你可以在Visual St