0

Possible Duplicate:
How does Facebook Sharer select Images?

I added link button and og tags. I checked my page on linter and no errors are reported, but image is not shown. However, if I click on that placeholder where image should be, it links to correct image. Does anybody knows why?

I'm using asp.net mvc3 and link to my image looks like this: http://www.domain.com/gallery/thumb/222/test-image.png

test-image.png does not exist on server, I'm using id (222) to find correct image and show it with content disposition, test-image is here only for SEO. Could that be a problem?

Community
  • 1
  • 1
mlaen
  • 53
  • 5

1 Answers1

0

If you try and retrieve the image (from the comments) using cURL or wget you get a 500:

$ wget http://noa-yachting.mlaen.com/Gallery/Thumb/99/200/hanse-495-croatia-charter.png
--2011-09-06 07:41:49--  http://noa-yachting.mlaen.com/Gallery/Thumb/99/200/hanse-495-croatia-charter.png
Resolving noa-yachting.mlaen.com... 178.218.172.36
Connecting to noa-yachting.mlaen.com|178.218.172.36|:80... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
2011-09-06 07:41:49 ERROR 500: Internal Server Error.

$ response=`curl --write-out %{http_code} --silent -k -G http://noa-yachting.mlaen.com/Gallery/Thumb/99/200/hanse-495-croatia-charter.png`
$ echo $response
 This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using <customErrors mode="Off"/>. Consider using <customErrors mode="On"/> or <customErrors mode="RemoteOnly"/> in production environments.-->500

So long as you provide a link with returns the image bytes and a 200 OK response when you issue an HTTP GET to it then you'll be fine.

I also downloaded the image and uploaded it to my own server and added it to an OG page - it worked like a charm. So, the answer to your question is, why isn ASP.net correctly returning the image when the browser requests it, but not when it's requested by cURL or wget?

I have very little to go on for this, are you doing something like creating a session when a user goes to your main page and then checking that session before serving the image? I do have a bunch of cookies from your domain so this seems at least plausible. If so you need to allow that image to be viewable to everyone, or at the very least find the user agent of the facebook crawler and always allow it to view the image.

Update: Viewing the image in a clean browser before viewing the page URL the image still loads fine, so I don't think that can be the problem. I've never used ASP or IIS so I'm running out of ideas, but this is definitely your problem.

Update 2: Got it! Verbose output in cURL ftw. This is what you're server is generating:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below

[NullReferenceException: Object reference not set to an instance of an object.]
   NoaYachting.ClientSite.Controllers.BaseController.ExecuteCore() in D:\DEV\NoaYachting\NoaYachting\NoaYachting.ClientSite\Controllers\BaseController.cs:69
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8841105
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

I'm afraid you're on your own fixing that tho :)

mrtom
  • 2,148
  • 1
  • 14
  • 21
  • Thanks for your answer. Do you know if there is any other way, without linking directly to the actual image? – mlaen Sep 05 '11 at 09:18
  • Added extra info to the answer. Hopefully that should be clearer – mrtom Sep 05 '11 at 09:30
  • Sorry, I had to unaccept this answer, when I had another look at it :) This is my real url (with correct domain): http://noa-yachting.mlaen.com/Gallery/Thumb/99/200/hanse-495-croatia-charter.png and that link is in ob tag and in and is still doesnt shows it :( – mlaen Sep 05 '11 at 22:48
  • Wow, you're fast :) Take another look at my comment, I hit enter too early :) – mlaen Sep 05 '11 at 22:51
  • What's your OG page with the OG tags in it? – mrtom Sep 05 '11 at 22:56
  • http://noa-yachting.mlaen.com/en/Yachts/Details/4/hanse-495-croatia-charter – mlaen Sep 05 '11 at 23:00
  • I stand by my answer, you're actually returning 500 errors when you try and access the image. I'll update my answer with new findings (ps, sorry for delay, I fell asleep :) – mrtom Sep 06 '11 at 06:43