-- In the Head Section of Master Page ...add a place holder like this :-
<head id="Head1" runat="server">
<asp:PlaceHolder id="MetaPlaceHolder" runat="server" />
</head>
--------------------
Then in the Content page add the following code.
-------------------------------------------------------------
protected void Page_Load(object sender, EventArgs e)
{
BuildMetaTags();
}
private void BuildMetaTags()
{
PlaceHolder Metaplaceholder = (PlaceHolder)this.Master.Page.Master.FindControl("MetaPlaceHolder");
System.Web.UI.HtmlControls.HtmlMeta _metaTag1 = new HtmlMeta();
System.Web.UI.HtmlControls.HtmlHead _head = (HtmlHead)Page.Header;
_metaTag1.Name = "title";
_metaTag1.Content = "Convert PDF to Word Online using Quick Free PDF to Word Converter";
System.Web.UI.HtmlControls.HtmlMeta _metaTag2 = new HtmlMeta();
_metaTag2.Name = "description";
_metaTag2.Content = "Convert PDF to Word online within few clicks and receive it via email. Learn how to convert pdf to word instantly with Free PDF to Word Converter";
System.Web.UI.HtmlControls.HtmlMeta _metaTag3 = new HtmlMeta();
_metaTag3.Name = "keywords";
_metaTag3.Content = "free pdf to word converter, free pdf to word, convert pdf to word free, free pdf to doc converter";
System.Web.UI.HtmlControls.HtmlMeta _metaTag4 = new HtmlMeta();
_metaTag4.Name = "robots";
_metaTag4.Content = "index, follow";
//_head.Controls.Add(_metaTag1);
//_head.Controls.Add(_metaTag2);
//_head.Controls.Add(_metaTag3);
//_head.Controls.Add(_metaTag4);
if (Metaplaceholder != null)
{
Metaplaceholder.Controls.Add(new LiteralControl("\n"));
Metaplaceholder.Controls.Add(_metaTag1);
Metaplaceholder.Controls.Add(new LiteralControl("\n"));
Metaplaceholder.Controls.Add(_metaTag2);
Metaplaceholder.Controls.Add(new LiteralControl("\n"));
Metaplaceholder.Controls.Add(_metaTag3);
Metaplaceholder.Controls.Add(new LiteralControl("\n"));
Metaplaceholder.Controls.Add(_metaTag4);
Metaplaceholder.Controls.Add(new LiteralControl("\n"));
}
}
0 comments:
Post a Comment