ASP.NET Change facebook og properties from content page
I want to dynamically change in code behind facebook og properties like
< me开发者_如何学运维ta property="og:image" content="image_link" />
< meta property="og:title" content="title" />
How to do this?
btw. I'm adding regular meta tags like this:
HtmlMeta tag = new HtmlMeta();
tag.Name = "description";
tag.Content = message;
Page.Header.Controls.Add(tag);
Here is how you add the proprietary Facebook "property" attribute to a standard META tag:
HtmlMeta tag = new HtmlMeta();
tag.Attributes.Add("property", "og:title");
tag.Content = "MyTitle"; // don't HtmlEncode() string. HtmlMeta already escapes characters.
Page.Header.Controls.Add(tag);
if what you want is to add a property attribute in c# to HtmlControl this should be like so:
tag.Attributes.Add(KEY, VALUE);
where KEY = "property" and VALUE = "og:image"
hope this helps
精彩评论