Add Meta Tag and Link tag in head section of page in Asp.net.
Submitted by jitendramcu on Sunday, November 8, 2009 - 17:13.
<link>-use to include css file in webpage.
protected void Page_Load(object sender, EventArgs e)
{
HtmlLink link = new HtmlLink();
link.Href = MapPath("~/App_Themes/GreenBlack") + "\\Stylesheet1.css";
//Acctual path of css file in your website folder.
link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("type", "text/css");
Page.Header.Controls.Add(link);
//add that link to page header because link tag is a part of head section of html.
}
<meta>used to show the page description, keywords, author of the document etc in web page.
Add MetaTage Dynamically in Asp.net.
HtmlMeta metaTag = new HtmlMeta();
metaTag.Attributes.Add("name", "Keyword");
metaTag.Attributes.Add("content", "Asp.net,C# Tutorial.");
Page.Header.Controls.Add(metaTag);
//add that meta tag to page header because meta tag is a part of head section of html.
Run the web Page ,right click on web page,slect view source and see you meta tag in header section of page.
Add new comment
- 30 views