.NET FAQs Unleashed!
 
    
    

Can Meta Tags be set through the Page directive?

ASP.NET 4.0 allows setting some meta tags through the Page directive.

 

See the example below:

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Keywords="Crackerjack, Interview, Questions, Answers,.NET" Description="Here goes the description" %>

 

The attributes Keywords and Description allow doing this.

 

When the page renders, the source code of the web page appears like this:

 

<head id="Head1" runat="server">

<title>Untitled Page</title>

<meta name="keywords" content=" Crackerjack, Interview, Questions, Answers,.NET " />

<meta name="description" content=" Here goes the description” />

</head>

ASP.NET 4 when IIS is reset   Meta Tags using the Page Directives   Response.Redirect(), Response.RedirectPermanent(), Server.Transfer()   Shrinking Session State   Expanding size of allowable URL   Preventing XSS Attacks in ASP.NET 4   New features in ASP.NET 4.0   Features of ASP.NET 4.0 Chart Control   Advantage of Response.RedirectPermanent()   Benefit of Extensible Output Caching   URL Routing   Web.config Refactoring   Controlling IDs of Controls   Monitor Performance in ASP.NET 4.0