Programmatically adding LINKs to HTML HEADER in Code Behind

In this example I am adding a link to the html header pointing to an rss feed.
HtmlLink link = new HtmlLink();
link.Attributes.Add("type", "application/rss+xml");
link.Attributes.Add("rel", "alternate");
link.Attributes.Add("href", Page.ResolveClientUrl("~/rss/LatestArticles/"));
this.Header.Controls.Add(link);

No comments:

Post a Comment