Friday, April 27, 2012

Dynamically creating meta tags in asp.net mvc by Html.Raw

http://www.dotnetjalps.com/2012/04/dynamically-creating-meta-tags-in.html

public string HomeMetaTags()
{
  System.Text.StringBuilder strMetaTag = new System.Text.StringBuilder();
  strMetaTag.AppendFormat(@"<meta content='{0}' name='Keywords'/>","Home Action Keyword");
  strMetaTag.AppendFormat(@"<meta content='{0}' name='Descption'/>", "Home Description Keyword");
  return strMetaTag.ToString();
}
 
ViewBag.MetaTag = HomeMetaTags();
@Html.Raw(ViewBag.MetaTag)

No comments:

Post a Comment