Search code examples
c#asp.netfacebook

Facebook not detecting og tags


Once again I find myself in need of your collective genius. I have a website built in ASP.NET 4.5 using c#, its a web forms site if that is at all relevant. I have the following script in my master page to generate the required meta og:whatever tags.

var ogtitle = "<meta name=\"og:title\" content=\"" + this.Page.Title + "\" />";
        var ogsname = "<meta name=\"og:site_name\" content=\"Griffiths Web Design\" />";
        var ogtype = "<meta name=\"og:type\" content=\"website\" />";
        var ogdesc = "<meta name=\"og:description\" content=\"" + this.Page.MetaDescription + "\" />";
        var ogurl = "<meta name=\"og:url\" content=\"" + HttpContext.Current.Request.Url.AbsolutePath + "\" />";
        var ogimg = "<meta name=\"og:image\" content=\"www.griffithswebdesign.com/images/binaryearth.jpg\" />";
        fbmets.Text = ogimg + ogtitle + ogurl + ogsname + ogtype + ogdesc;

Which, when I run the site generates the following meta tags (I know they are there because I can see them when I view source)

<meta name="og:image" content="www.griffithswebdesign.com/images/binaryearth.jpg" /><meta name="og:title" content="A Simple blogging system in ASP.NET" /><meta name="og:url" content="/Blog/Post/24" /><meta name="og:site_name" content="Griffiths Web Design" /><meta name="og:type" content="website" /><meta name="og:description" content="A Simple blogging system in ASP.NET" />

Despite this when I try to share a link from my site to Facebook it comes up as not found. When I use the facebook debugger it is unable to find the tags. Is there something I'm missing? or have I completely misunderstood the process? as far as I can tell I have the required tags present in each page thanks to the script in the master page. Obviously something is wrong but as I said I'm lost.

Although this appears to be happening on every page here is a link to a page so you can have a look:

http://www.griffithswebdesign.com/Blog/Post/24

Any help would be greatly appreciated :)


Solution

  • Your website does not work with ipv6, although it has a AAAA record. This is my request when I use ipv6:

    GET /Blog/Post/24 HTTP/1.1
    Host: www.griffithswebdesign.com
    User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.7.1
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-US,en;q=0.5
    Accept-Encoding: gzip, deflate
    Connection: keep-alive
    
    HTTP/1.1 404 Not Found
    Content-Type: text/html; charset=us-ascii
    Server: Microsoft-HTTPAPI/2.0
    Date: Wed, 13 Apr 2016 13:14:16 GMT
    Connection: close
    Content-Length: 315
    

    When I force ipv4 using wget (wget -4 -S http://www.griffithswebdesign.com/Blog/Post/24), I see this:

    HTTP/1.1 200 OK
    Cache-Control: private
    Content-Length: 63543
    Content-Type: text/html; charset=utf-8
    Server: Microsoft-IIS/7.5
    X-AspNet-Version: 4.0.30319
    Set-Cookie: ASP.NET_SessionId=n324zpflwyicoiwdwy0fynbu; path=/; HttpOnly
    X-Powered-By: ASP.NET
    Date: Wed, 13 Apr 2016 13:17:10 GMT