Subscribe to the ASP.NET Robot RSS Feed

ASP.NET Title Tag and Meta Tags




Meta tags and title tag used to provide some basic information about a web page like page title, page description, page keywords and more.
I recommend don’t use more than 65 Characters (Including Spaces) for a Page Title Tag, for the meta description tag don’t use more than 150 Characters (Including Spaces) and for meta keywords tag Pick the 10 or 15 terms that most accurately describe the content of the page. But remember that today most of the search engines ignoring the Meta keywords tag.


This tags you can set in the head section of the page like this:

<head runat="server">
    <title>Your Page Title</title>
    <meta name="description" content="Your Page Description" />
    <meta name="keywords" content="Your Page Keywords" />
</head>



   
     

Define Title Tag and Meta Tags in ASP.NET 4.0

  

The following code demonstrates how you can set this properties programmatically from code behind in ASP.NET framework 4.0 within Page_Load() event handler

protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = "Your Page Title";
        Page.MetaDescription = "Your Page Description";
        Page.MetaKeywords = "Your Page Keywords";
    }

Or you can declare these tags in the @Page directive at the top of .aspx pages like this:

<%@ Page Title="Your Page Title" 
         MetaDescription="Your Page Description" 
         MetaKeywords="Your Page Keywords" 
         Language="C#" 
         AutoEventWireup="true" 
         CodeFile="Default.aspx.cs" 
         Inherits="_Default"  %>



    
    

Declare Title Tag and Meta Tags in ASP.NET 3.5 and Blow

 

The following code demonstrates how you can declare this properties programmatically from code behind in ASP.NET framework 3.5 and blow within Page_Load() event handler

protected void Page_Load(object sender, EventArgs e)
    {
        Page.Title = "Your Page Title";

        HtmlMeta metaDescription = new HtmlMeta();
        metaDescription.Name = "description";
        metaDescription.Content = "Your Page Description";
        Page.Header.Controls.Add(metaDescription);

        HtmlMeta metaKeywords = new HtmlMeta();
        metaKeywords.Name = "keywords";
        metaKeywords.Content = "Your Page Keywords";
        Page.Header.Controls.Add(metaKeywords);
    }

Add New Comment:

 
 
 
 
 
Gravatar

Waldo

casino games
online casino
slots
online casino
casino real money

Gravatar

Online

Expensive women but women viagra not work for the side grease Oh and if.

Gravatar

Pharmb515

Hello! generic viagra india pharmacy http://via3indian.com/#4.html

Gravatar

Pharmg199

Hello!

Gravatar

Pharmf329

Hello! [url=http://via3indian.com/#2.html]generic viagra india pharmacy[/url]

Gravatar

Smithc925

I have been surfing online more than 3 hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. In my view, if all webmasters and bloggers made good content as you did, the internet will be much more useful than ever before. efgkbddeaecfkebe

Gravatar

Conrad

a cheap viagra
viagra pills
viagra women sale online

Gravatar

Marianne

buy viagra online forum
order viagra online
cheap viagra uk

Gravatar

Cialis

Viagra, four for and one for Levitra, said spokeswoman Susan Cruzan.

Gravatar

Spencer

best diet pill available
weight loss supplements
weight loss pills
lose weight fast
weight loss pills

Gravatar

Carrol

appetite suppressant
natural weight loss supplements
diet pills that really work
weight loss drugs prescription
alli weight loss reviews

Gravatar

Finlay

weight loss pill
diet pills
metformin weight loss
weight loss prescription drugs
new weight loss medication

Gravatar

Chana

cheap viagra paypal payment
viagra without a doctor prescription
viagra cheap no prescription

Gravatar

Net

Your book there is for a generic cover, left, to return, they rely on more expensive.

Facebook del.icio.us FriendFeed Digg it Google Buzz Linked in MySpace Reddit Stumbleupon Twitter Technorati