Hi
As per the article Adding Meta tags to Master Page and ASPX Child Content Pages in ASP.Net.
I have developed a following code for add Meta tags dynamically in each product pages.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim dtMeta As DataTable = GetData()
''Add Page Title.
Me.Page.Title = dtMeta.Rows(0)("ItemName").ToString()
'Add Keywords Meta Tag.
Dim keywords As New HtmlMeta()
keywords.HttpEquiv = "keywords"
keywords.Name = "keywords"
keywords.Content = dtMeta.Rows(0)("MetaTagKeywords").ToString()
Me.Page.Header.Controls.Add(keywords)
'Add Description Meta Tag.
Dim description As New HtmlMeta()
description.HttpEquiv = "description"
description.Name = "description"
description.Content = dtMeta.Rows(0)("MetaTagDescription").ToString()
Me.Page.Header.Controls.Add(description)
If Not IsPostBack Then
If Page.RouteData.Values("ProductName") Is Nothing Then
Response.Redirect(ResolveUrl("~/products"))
Else
BindData_ExpProducts_ItemName_Web()
BindData_Repeater1()
End If
End If
End Sub
Private Function GetData() As DataTable
Using cmd As New SqlCommand("ExpProducts_ItemName_Web")
cmd.Connection = constrWeb
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@ProductName", SqlDbType.NVarChar, 100).Value = Page.RouteData.Values("ProductName")
Using sda As New SqlDataAdapter()
cmd.Connection = constrWeb
sda.SelectCommand = cmd
Dim dt As New DataTable()
sda.Fill(dt)
Return dt
End Using
End Using
End Function
Page title display but, meta tag not change.
Thanking you
samsmuthu