Loading

Add Meta Tag and Link tag in head section of page in Asp.net.

Submitted by: 


<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.




Tags: 

Add new comment

Filtered HTML

  • You may insert videos with [video:URL]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.