Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
Go to DotNetFunda.com
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 4718 |  Welcome, Guest!   Register  Login
Home > Articles > ASP.NET > ASP.NET 4.0 Features - MetaDescription and MetaKeywords

ASP.NET 4.0 Features - MetaDescription and MetaKeywords

Article posted by Abhijit Jana on 3/1/2010 | Views: 9227 | Category: ASP.NET | Level: Beginner red flag

Advertisements

Advertisements
ASP.NET 4.0, came up with two new properties inside Page Class, those are MetaDescription and MetaKeyWord. This has been introduce because of make web application Search Engine Friendly. Search Engine looks for Meta tag of our web page to get the details of page contents. In ASP.NET 4.0, we can add these two properties with page class in Code behind or in Page Directives.

Introduction
ASP.NET 4.0, came up with two new properties inside Page Class, those are MetaDescription and MetaKeyWord. This has been introduce because of make web application Search Engine Friendly.  Search Engine looks for Meta tag of our web page to get the details of page contents.  In ASP.NET 4.0, we can add these two properties with page class in Code behind or in Page Directives.

If you want to find out the definition of these two properties, Right Click on Page Class and Click on Goto Definition. This will show you the Meta data information of Page Class as shown in below picture.


Fig:Page Class with MetaDescription and MetaKeyWords Properies
How to use ?


If we set MetaDescription and MetaKeywords either from Code behind or using Page Directive in aspx page, both will be render as “meta” tag in html code.
Let have a look, how we can set these two properties from code behind,

protected void Page_Load(object sender, EventArgs e)

{

Page.MetaKeywords = "ASP.NET 4.0, .NET 4.0";

Page.MetaDescription = "ASP.NET 4.0 Information";

}



Fig: Set MetaKeywords and MetaDescription Properties using Codebehind

Now, If I run the application and check the HTML rendered content we will found the following code,

<head>

<meta content="ASP.NET 4.0 Information" name="description" />

<meta content="ASP.NET 4.0, .NET 4.0" name="keywords" />

</head>

Similarly we can also add MetaKeywords and MetaDescription Properties  in Page Directive Itself. 


But the HTML output will be same for both the case.

Fig: HTML Rendered content of MetaKeywords and MetaDescription

Conclusion
The main objective of MetaKeywords and MetaDescription proerties to make your web application SEO friendly. In ASP.NET 2.0, HtmlMeta used to do the same, but in ASP.NET 4.0 make these thing  very simple as we can easily add using Page Class.
Please share your feedback and suggestion to improve this article.

Reference :
ASP.NET 4.0 Features

Advertisements

If you like this article, subscribe to our RSS Feed. You can also subscribe via email to our Interview Questions, Codes and Forums section.

Page copy protected against web site content infringement by Copyscape
Found interesting? Add this to:



Please Sign In to vote for this post.

About Abhijit Jana

Experience:3 year(s)
Home page:http://abhijitjana.net
Member since:Wednesday, December 24, 2008
Level:Bronze
Status: [Member] [MVP]
Biography:He has done Master Degree in Computer Application and currently working as a Sr. S/W Developer in a US based MNC and having more than 3 years exp. He has worked with all the .NET framework and good exposer in Web and Windows based development using Microsoft Technology . Currently he working with C# 3.5, ASP.NET 3.5, Enterprise Library 4.1 and SDL Tridion also Exploring VS 2010 with .NET 4.0.
 Responses
Posted by: Sashidhar.ssd | Posted on: 01 Mar 2010 07:11:41 AM

Nice One as always..!

>> Write Response - Respond to this post and get points
Related Posts

ModalPopupExtender is used to open a pop-up or to open a separate ASP.NET page as a pop-up

In case we have to give ability to the user to select the columns that should appear in the GridView, we can follow this approach.

In this tutorials, I am going to explain how to read appSettings and connectionStrings values from the web.config file.

SQL Server is a very large subject in itself. Rather than attempting to cover all aspects of SQL Server database access, this article focuses on those areas where you are likely to gain the biggest payoffs.

In this article, we are going to learn how to implement SQL Caching in ASP.NET using Poll based SQL Cache dependency. The push based SQL Cache dependency shall be covered in other article. In poll based, SQL Cache dependency checks for the updated data after every specified duration. With the help of Caching, we can retain pages or data across HTTP requests, so that we can reuse them without recreating them.

More ...
About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/19/2013 1:31:13 PM