If you are using some Content Management System (CMS) for your web site, then there is good chance that all your content along with meta tag content like Title, Description, Keywords etc. is stored in some data source and need to be added to the page dynamically. This all is doable from server side using HtmlMeta html server side control to Controls collection of Header of your page. You just need to add head element to your page and make sure that you have set runat=server for it and you are good to go. See the following snippet how it is done.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.Header.Title = "My Page Title";
HtmlMeta meta = new HtmlMeta();
meta.Content = "my description for this page";
meta.Name = "description";
this.Header.Controls.Add(meta);
}
}
And on the page I have defined the mark up like this.
<head runat="server">
<title></title>
</head>
How to set meta tags on ASP.Net page programatically
How to plan CCSP Exam preparation
Develop a MongoDB pipeline to transform data into time buckets
Alert and Confirm pop up using BootBox in AngularJS
AngularJS Grouped Bar Chart and Line Chart using D3
How to lock and unlock account in Asp.Net Identity provider
2024 © Byteblocks, ALL Rights Reserved. Privacy Policy | Terms of Use