This page explica la nueva función: ASP.Net 4 añade 2 nuevas propiedades relacionadas etiqueta Meta a la página. Se pueden usar para establecer metaetiquetas para palabras clave y descripción.
Se puede establecer en el código subyacente:
Page.MetaKeywords = "keyword1, keyword2, keyword3";
Page.MetaDescription = "Example of new meta tag support in ASP.Net 4";
También puede configurar en la directiva @ Page:
<%@ Page Language="C#" AutoEventWireup="true"
MetaKeywords="keyword1, keyword2, keyword3"
MetaDescription="Example of new meta tag support in ASP.Net 4"
CodeFile="Default.aspx.cs" Inherits="_Default" %>
que la salida de cualquiera de estos métodos representa HTML similar a la siguiente:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
ASP.NET 4 Meta Tag Support
</title>
<meta name="description" content="Example of new meta tag support in ASP.Net 4" />
<meta name="keywords" content="keyword1, keyword2, keyword3" />
</head>
<body>
</body>
</html>
he utilizado la solución en su vínculo con Blog de Rick Strahls; funcionó un placer. Muchas gracias. – doogdeb
He intentado hacer lo siguiente como arriba: if (! IsPostBack) { // Meta Tags. var metaTags = new HtmlMeta {Name = "W", Content = "Smart"}; Header.Controls.Add (metaTags); metaTags = new HtmlMeta {Name = "W.cg", Contenido = "afasfsa"}; Header.Controls.Add (metaTags); Me da un error: no se puede modificar la colección de controles. Tu ayuda será apreciada. – Ruruboy