title: dynamically create facebook share metatags [og:] in asp.net
body: <p>I am trying to create meta tags in code behind for my website which has a blog section. so each blog will have their own title, image. hence created in code behind. just wanted to make sure if this is right and Facebook/Google+ will recognize it.</p>
  
  <h1>CODE BEHIND</h1>
  
  <pre><code>private void AddMetaTagsForPage(object tempObject)
        {
              string[] metaTags = {"og:title", "og:site_name", "og:type", "og:url", "og:image"};
  
              foreach(string str in metaTags)
              {
                    HtmlMeta tag = new HtmlMeta();
  
                    switch(str)
                    {
                          case "og:title":
                                tag.Name = str;
                                tag.Content = tempObject.ChallengeTitle;
                                Page.Header.Controls.Add(tag);
                                break;
                          case "og:site_name":
                                tag.Name = str;
                                tag.Content = "http://www.mysite.com";
                                Page.Header.Controls.Add(tag);
                                break;
                          case "og:type":
                                tag.Name = str;
                                tag.Content = "blog";
                                Page.Header.Controls.Add(tag);
                                break;
                          case "og:url":
                                tag.Name = str;
                                tag.Content = HttpContext.Current.Request.Url.AbsoluteUri;
                                Page.Header.Controls.Add(tag);
                                break;
                          case "og:image":
                                tag.Name = str;
                                tag.Content = String.Format("http://static.mountainwarehouse.com" + tempObject.ChallengeImageURL);
                                Page.Header.Controls.Add(tag);
                                break;
                    }
              }
        }
  </code></pre>
  
  <h1>GENERATED HTML</h1>
  
  <pre><code>    &lt;meta content="No appointment necessary. We hear you coming." name="og:title"&gt;
      &lt;meta content="http://www.mysite.com" name="og:site_name"&gt;
      &lt;meta content="blog" name="og:type"&gt;
      &lt;meta content="http://dev.mysite.com/entries/viewentry.aspx?entryId=34"
      name="og:url"&gt;
      &lt;meta content="http://static.mysite.com/Images/2a7803a2-e8f1-424c-9f53-3ddc1fe33c3e.jpg" name="og:image"&gt;
  </code></pre>
  
  <p>on facebook and google+ it says that you must have meta tags in this format.</p>
  
  <pre><code>&lt;meta content="No appointment necessary. We hear you coming." property="og:title"&gt;
  </code></pre>
  
  <p>instead of property keywords i have name. I dont know how to create that in asp.net. is it valid for facebook?</p>
  
  <p>please help</p>