Developer forum

Forum » Templates » constant problem with Facebook share (images not valid content)

constant problem with Facebook share (images not valid content)

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

As you see here, I have problem with facebook not accepting the image content type https://developers.facebook.com/tools/debug/sharing/?q=https%3A%2F%2Fwww.apotek.fo%2Fvi%25C3%25B0kvom-tarmey%25C3%25B0kenni-leyst-liv-og-trekur-magi

 

I Have tried urlEncoding the string, so that I got something like https%3A%2F%2Fwww.apotek.fo%2FFiles%2FImages%2FInnihaldsmyndir%2FBagir%20naka%C3%B0%2Ftrekur%20magi.jpg

 

But this is not recogniced as a url. Have tried replacing whitespace with %20, but that just gives 404.

 

Any suggestions?

 

/Hans


Replies

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
Try this: https://developers.facebook.com/tools/debug/sharing/?q=https%3A%2F%2Fwww.apotek.fo%2FFiles%2FImages%2FInnihaldsmyndir%2FBagir%2520naka%25C3%25B0%2Ftrekur%2520magi.jpg
 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi Morten

 

that works perfectly, but how can I encode the url like this dynamically? UrlEncode does not give this result.

 

/Hans

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

I'm not sure which UrlEncode you are using. Can you provide an example?

You can use methods like encodeURIComponent in js, encoding extensions for template tags or System.Net.WebUtility in C# code for encoding the file names.

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Yes

I´m doing this

image=HttpUtility.UrlEncode(image);

it gives this result

https%3a%2f%2fwww.apotek.fo%2fFiles%2fImages%2fInnihaldsmyndir%2fBagir+naka%c3%b0%2ftrekur+magi.jpg 

 

Problem is probably that the whitespace is being replaced with +

 

 

You must be logged in to post in the forum