Facebook Graph API Requests from .NET (C#) -


i have application generates web request facebook graph api share count external page. have been using code on year without issue, , suddenly, share count not working when request made .net. however, if make request web browser, works fine. code follows:

string fblink = "https://graph.facebook.com/?id=" + externallink + "&fields=og_object%7bengagement%7d&access_token=<token_removed>"; webclient client = new webclient(); string fbstring = client.downloadstring(fblink); 

this code still appears working fine, in request made, , fb responds no errors. in fact, responds correct page id, , details. however, share count zero.

here gets little bit weird. on localhost development machine, code works fine , returns proper share count. however, if run code on actual server (an aws ec2 instance), share count shows zero.

if open chrome , run request browser, share count displays expected.

if open internet explorer 11, , run request browser, counter shows zero. however, if log in facebook ie11, , run request fb graph api, response shows correct page count.

this confusing me, appears reason counter has stopped working, has cookies, or maybe browser being logged fb. should not case using app token id, , wouldn't expect need logged fb in order make request graph api.

does have ideas why request/code in .net worked fine year , half, , stopped working? or why requests work fine on localhost , not live server?

after spending considerable time on issue, have fixed issue. there fb authentication cookie being transmitted through web browser query. cookie name "xs" , value long string used sessionid specific login. if created cookie in web request in c# code, proper response correct # of shares.

webclient client = new webclient(); client.headers.add("cookie", "xs=<removed>;"); 

i have no idea why have this, on ec2 server. in fb's documentation have spoof valid logged in authentication string cookie in order obtain correct share count results request it's graph api, there have it. workaround @ least.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -