dynamically setting facebook meta tags in page

Posted on 2012-08-12
Last Modified: 2012-08-13
I have a web page that let's a user pick a video and then plays the video.
It is similar to YouTube.  
After the user has picked a video they can later reference the video with the URL.
The URL would be something like this -
Where "123" is the id of the video they wish to play.
I am setting meta tag content dynamically on page load using
If I view the page - I can see that the facebook metatags have been properly rendered.
All the proper facebook opengraph tags are there including "og:image" and that tag resolves to a jpg image on my server.
When I paste the above link in to facebook it does not pull the image in to the facebook post.
However if I hard-code the og:image meta tag in to the page then the preview image will display in the facebook post.

My question is, do the dynamic meta tags actually get rendered when facebook reads the URL?  I currently have the code in the page_load event of the page.  

Any help would be greatly appreciated.

Thanks,  Kevin.
Question by:kevinvw1
    1 Comment

    Accepted Solution

    I figured out the issue.  
    Found a reference here -

    Facebook was reading the tags just fine.  The tags were not formed quite right.  I was using HTMLMeta and adding tags like this -

    HtmlMeta _ogDescription = new HtmlMeta();
    _ogDescription.Name = "og:description";
    _ogDescription.Content = "";

    which gives me - <meta name="og:description" content="This is a test" />
    What I needed to do was set the meta tag as "property" not "name" like this -

    _ogDescription.Attributes.Add("property", "og:description");
    _ogDescription.Content = "";

    which gives me - <meta property="og:description" content="This is a test" />

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
    Read about why website design really matters in today's demanding market.
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now