EnjoySharePoint YouTube Channel

Adding meta tags to aspx pages in asp.net

In this article, we will discuss how to add meta tags and meta description to the .aspx page in an Asp.Net website. Meta tags and descriptions are very much useful in the context of the search engine. So it is necessary to give meta tags and meta descriptions to web sites.

Get Office 365 Enterprise E3 Or Business Premium Subscription & Try out all the features

There are at least 3 ways we can add meta tags and description to an .aspx page.

1. Add in the page directive:
We can add meta tags and description to the page directive of an .aspx page like below:

<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”MetaTagTest.aspx.cs” Inherits=”MetaTagTest” MetaDescription=”A SharePoint and Asp.Net web site” MetaKeywords=”SharePoint,Asp.Net,C#.Net,SQL Server” %>

Here MetaDescription, MetaKeywords are the tags to whom we can set the description and tag respectively.

2. Inside head section:
We can add Meta tags and description inside the <head> </head> section of an .aspx page like below:

<meta name=”description” content=”A SharePoint and Asp.Net web site” />
<meta name=”keywords” content=”SharePoint,Asp.Net,C#.Net,SQL Server” />

3. Through .aspx.cs code:
Through code we can also add meta tag and meta description to a page like below:

protected void Page_Load(object sender, EventArgs e)
Page.MetaDescription = “A SharePoint and Asp.Net web site”;
Page.MetaKeywords = “SharePoint,Asp.Net,C#.Net,SQL Server”;

Check out Best Alternative to InfoPath -> Try Now
You May Also like the Following SharePoint Tutorials:

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SharePointSky.com

View all posts by Bijay Kumar →