{"id":1552,"date":"2022-08-30T15:17:29","date_gmt":"2022-08-30T15:17:29","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/27\/problem-about-facebook-c-sdk-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:17:29","modified_gmt":"2022-08-30T15:17:29","slug":"problem-about-facebook-c-sdk-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/problem-about-facebook-c-sdk-collection-of-common-programming-errors\/","title":{"rendered":"problem about facebook-c#-sdk-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/678c7ee0f57988f895fe47057eef817c?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRichard<br \/>\nfacebook-c#-sdk<br \/>\nI have been successful in creating test users for my console-based application using: public dynamic CreateTestUser(string name) {return client.Post(APP_ID + &#8220;\/accounts\/test-users?installed=true&amp;name=&#8221; + name + &#8220;&amp;permissions=read_stream&#8221;); }However, now I&#8217;m trying to delete the users that I have created and have not had success.One method I&#8217;ve tried is the following:FacebookClient client = new FacebookClient(APP_ID, APP_SECRET); dynamic result = client.Delete(userId);Another method I&#8217;ve<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/c5bea353d31324c9862a4ee8fc525ae8?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nPhilip Danks<br \/>\nc# facebook facebook-graph-api sdk facebook-c#-sdk<br \/>\nI am getting the following error when trying to run code from http:\/\/facebooksdk.blogspot.co.uk\/2011\/04\/facebook-groups.htmlThe error is &#8220;Invalid CastException Was Unhandled&#8221; and &#8220;Specified Cast Is Not Valid&#8221;I am using the Facebook C# SDK and I am using the following code&#8230;public Dictionary&lt;string, string&gt; GetGroups(){string accessToken = _accessToken;FacebookClient facebookClient = new FacebookClient(accessToken);JsonObject resul = facebookClient.Get(&#8220;https:\/\/graph.facebook.com\/me\/groups<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/91065901c20d28168140fab0f48e6259?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\njovem<br \/>\nc# wpf facebook windows-phone-7 facebook-c#-sdk<br \/>\nI&#8217;m new in these things and I&#8217;ve been testing the api &#8230; and came to me a situation that is:if the user changes the password of Facebook the Access token is renewed &#8230; and try to post the API Launches an exception and the application crashes&#8230; how to resolve this situation?try {FacebookApp app = new FacebookApp(FacebookToken);var args = new Dictionary&lt;string, object&gt;();args[&#8220;message&#8221;] = &#8220;hi&#8221;;args[&#8220;caption&#8221;] = &#8220;appcaption&#8221;;args[&#8220;description&#8221;] = &#8220;appdescription&#8221;;args[&#8220;name&#8221;] = &#8220;appname&#8221;;a<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/bfb6d860a31994f925b6e34bed60f101?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nloyalpenguin<br \/>\nc# .net windows-phone-7 facebook-c#-sdk<br \/>\nI recieve this exception when I try to run the sample application for WP7 that comes with the Facebook C# SDK:File or assembly name&#8217;Microsoft.Contracts, Version=1.0.0.0,Culture=neutral,PublicKeyToken=736440C9B414EA16&#8242;, orone of its dependencies, was notfound.It occurs at this part in code:\/\/ Constructorpublic MainPage(){InitializeComponent();_fbClient = new FacebookClient();FacebookLoginBrowser.Loaded += new RoutedEventHandler(FacebookLoginBrowser_Loaded);}Not sure what this means, as this is th<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ed313a3544541a0211e19ff1f878b6db?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nbratsche<br \/>\nfacebook facebook-graph-api facebook-c#-sdk<br \/>\nDeveloping a WP7 app, and I&#8217;m trying to post something to the user&#8217;s feed. We have all this working on iPhone already, and we have a test account created already. With the iPhone it&#8217;s able to post to our test user&#8217;s page.I&#8217;m trying to use the Facebook C# sdk to do the same thing, using the same account. I can successfully login to the test user&#8217;s account and obtain the AccessToken. When I login, the extended permissions I request from the user are &#8220;read_stream&#8221;, &#8220;publish_stream&#8221;, &#8220;publish_ch<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/fbc0a27049271cadb696ad956decbc79?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBo Persson<br \/>\nasp.net facebook updatepanel facebook-c#-sdk<br \/>\nI have a facebook app with an asp.net update panel. It works fine when running outside facebook, however once I run the app in Facebook the update panel stops working. I check the javascript console and found the following errors were occuring.Uncaught Sys.WebForms.PageRequestManagerParserErrorException:Sys.WebForms.PageRequestManagerParserErrorException: The messagereceived from the server could not be parsed. Common causes for thiserror are when the response is modified by calls to Response.Wr<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/a1c76a551bd666266265d43086cf29d7?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nKassem<br \/>\njquery ajax facebook jquery-ajax facebook-c#-sdk<br \/>\nThis is a follow-up to AJAX Call Does Not Trigger Action Method When Decorated With CanvasAuthorize So I found the following links and it seems that this is a common problem:http:\/\/facebooksdk.codeplex.com\/discussions\/251878http:\/\/facebooksdk.codeplex.com\/discussions\/250820I tried to follow the advice by prabir but I couldn&#8217;t get it to work&#8230; Here&#8217;s my setup:I have the following snippet in the page where the button that triggers the whole post to facebook is located:@if (!string.IsNullOrEmpty(R<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/6fee0eadff10e3f1d76e98d7924f6ff3?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\noteal<br \/>\nfacebook-c#-sdk<br \/>\nI made the example in http:\/\/csharpsdk.org\/docs\/web\/getting-started, and it works. But the javascript is constantly executing, so he&#8217;s constantly do a post on the server.. Always invoke the handler who Redirect to About.aspx and codebehind read the name, ID and other user information.form.setAttribute(&#8220;action&#8221;, &#8216;\/FacebookLogin.ashx&#8217;);In my MasterPage I have the &lt; div id=&#8221;fb-root&#8221;&gt; and the script code right after the tag &lt; body&gt; (inside the body). And in my Default.aspx I have the button to<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/14a93048c4fc7fa14a61bb15719233a1?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMax Favilli<br \/>\nc# javascript facebook facebook-c#-sdk<br \/>\nWe are developing a web app (http:\/\/beta.dammela.it) which use both FB Graph api server side, FB Javascript SDK and social plugins.The integration with FB is deep and we would like to detect when a user visiting our website is behind a proxy which block all traffic to Facebook properties (like in some working place).If we could detect he is blocked we could give him\/her some hints, help, explanation and some alternative methods to login and interact with the application.But I can&#8217;t figure out ho<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/133978b437b712189938510d2072a137?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nChris<br \/>\nasp.net facebook facebook-c#-sdk<br \/>\nI&#8217;m trying out the facebook c# SDK (v4.0.2) and am experiencing a 404 error when facebook tries to redirect back to the redirect handler for the SDK. The resulting URL is:http:\/\/localhost:9152\/facebookredirect.axd\/elserdemo\/Default.aspx?session={%22session_key%22%3A%222.GJsQK_BkApJNH8TncuFHpQ__.3600.1291665600-678938033%22%2C%22uid%22%3A%22678938033%22%2C%22expires%22%3A1291665600%2C%22secret%22%3A%22dnmnVip8JJ31rHUs2byKeQ__%22%2C%22base_domain%22%3A%22localhost%22%2C%22access_token%22%3A%22133<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/04edbbf48df9b0613f942cc0690fd76b?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMatt B<br \/>\nc# facebook facebook-c#-sdk<br \/>\nI&#8217;m driving myself to despair trying to get an album added to a facebook page using the C# SDK..I think my code is OK as I can successfully create an album on my own profile page through the SDK and API. So, I expect something&#8217;s getting confused with my access tokens and permissions etc.My c# code is here:string accessToken = &#8220;TOKEN HERE&#8221;;FacebookClient facebookClient = new FacebookClient(accessToken); var albumParameters = new Dictionary&lt;string, object&gt;(); albumParameters[&#8220;message&#8221;] = &#8220;ne<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/3eb823906627e3f66814342ea7ace6a1?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJCPhlux<br \/>\nsilverlight facebook-c#-sdk facebook-credits<br \/>\nI have been able to get my Silverlight App connected to Facebook and get authenticated.I am trying to pull the users credits balance into my Silverlight app the documentation at developers.facebook.com\/docs\/creditsapi has a one line example that references the Facebook Credits Sample application from Githu that is writen in php. looking at the file from the Githu example facebookapi_php5_restlib.php and the documentation Converting Facebook PHP examples I should be able to get the balance with s<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/25dd503fde06f17ed81d30a0cda729d9?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAfnan Bashir<br \/>\nc# facebook-c#-sdk<br \/>\nI am trying to get facebook wall but I am having issues with JSON Nested structure.following is my code so farvar wall = (JsonObject)fb.Get(&#8220;me\/feed&#8221;); List&lt;FBWall&gt; myWall = new List&lt;FBWall&gt;(); foreach (var obj in (JsonArray)wall[&#8220;data&#8221;]) {FBWall myWall = new Wall();myWall.Id = (string)(((JsonObject)obj)[&#8220;id&#8221;]);}actual string in wall is coming something like this {&#8220;data&#8221;:[{&#8220;id&#8221;:&#8221;576376893_10150590188751894&#8243;,&#8221;from&#8221;:{&#8220;name&#8221;:&#8221;Afnan Bashir&#8221;,&#8221;id&#8221;:&#8221;576376893&#8243;},&#8221;story&#8221;:&#8221;\\&#8221;how are you man???<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/733dd4a9999a91bd283391a11c15d67d?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRichard Blevins<br \/>\nfacebook-c#-sdk<br \/>\nPlease give a sample of how to post to a group wall using the C# Facebook SDK found at this location https:\/\/github.com\/facebook-csharp-sdk\/facebook-csharp-sdk . Below is just a few lines of relevant code. An fb client is created, parameters filled in (not shown), and a fb.post call is made. For my attempt to post to a group wall, all I did was change the &#8220;me\/feed&#8221; to &#8220;groupId\/feed&#8221;. I could probably figure out what is wrong but the Facebook error provides no information. The error returned<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/1233ec65168f4aae4d939ae8fe6cde1e?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRobert Harvey<br \/>\nfacebook-c#-sdk photos<br \/>\nI&#8217;m trying to use the C# Facebook SDK to post a photo to a page that I am a content creator for.dynamic parameters = new ExpandoObject();parameters.message = txtMessage.Text;parameters.source = new FacebookMediaObject{ContentType = &#8220;image\/jpeg&#8221;,FileName = Path.GetFileName(ofd.FileName)}.SetValue(File.ReadAllBytes(ofd.FileName));When I try a path like the following it gives me an error that says (OAuthException &#8211; #2500) Unknown path components: \/ALBUM_ID\/photosfb.PostTaskAsync(&#8220;PAGE_ID\/ALBUM_ID\/p<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/8c78b970aac9302a50c3d646b916c1e6?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nJ. Steen<br \/>\nc# facebook facebook-javascript-sdk facebook-c#-sdk<br \/>\nEDIT: It seems that I can only make 2 posts per day. If I remove the Logout step I can post as much as I want.I&#8217;ve looked at many other &#8220;An error occurred. Please try again later&#8221; threads on here and haven&#8217;t seen exactly my issue so I feel it does warrant its own thread.I have an app thats sole purpose is to schedule and post messages to Facebook. This app has been working great. As flawless as a FB app can run. I was asked to force the user to relog in every post for security reasons so the fi<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/e6b384f27f242a7272ce4fa6d98734c4?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nRichard Ev<br \/>\nc# facebook-graph-api facebook-c#-sdk<br \/>\nIn my Facebook app I am seeing an error from the Facebook SDK for some users when getting their feed (using me\/home?limit=1000&amp;fields=from.fields(id,name),likes.fields(id),comments.fields(from.fields(id))).The error is:Facebook.FacebookApiException: (Exception &#8211; #0) Unknown identifier, 0_xxxxxxxat Facebook.FacebookClient.ProcessResponse(HttpHelper httpHelper, String responseString, Type resultType, Boolean containsEtag, IList`1 batchEtags)at Facebook.FacebookClient.Api(HttpMethod httpMethod,<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/cc2aa3c6f6eaa6cc815777bb91d9df79?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nDVD<br \/>\nfacebook-graph-api facebook-like facebook-c#-sdk<br \/>\nI&#8217;m developing an app, and when I try to create a like on a comment (of a page post) I always get the following error:{&#8220;error&#8221;: {&#8220;message&#8221;: &#8220;An unknown error has occurred.&#8221;, &#8220;type&#8221;: &#8220;OAuthException&#8221;, &#8220;code&#8221;: 1} }My request is:post 530880543615557_5607698\/likesI tried the page access token and the user access token and always gets this error. Whe I try to like normal comments from for instance my timeline it works fine.I tried via code and Graph Api explorer and got the same error on both.Any tho<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/f3e9be5492111e51a9ee388f06c829b0?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAttri<br \/>\nwindows-phone-7.1 facebook-c#-sdk<br \/>\nI am creating a windows Phone 7.1 App using Facebook SDK version 6.0.10.0 . I am setting facebook media object value through stream object my code is FacebookMediaStream media = new FacebookMediaStream { ContentType = &#8220;image\/jpeg&#8221;, FileName = &#8220;test Image&#8221; };media.SetValue(_imgStream); IDictionary&lt;string, object&gt; parameters = new Dictionary&lt;string, object&gt;();parameters[&#8220;message&#8221;] = &#8220;Test photo &#8221; + DateTime.Now.ToString();parameters[&#8220;source&#8221;] = media; fb.PostAsync(&#8220;me\/photos\/&#8221;,<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/07123541fba3343f9ddb5876595b99a7?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nAlex<br \/>\nwindows-phone-7 facebook-c#-sdk<br \/>\nI have a WP7 app using facebook SDK 5.4.1. I try to upload a photo to Facebook, but always get an error message &#8220;(OAuthException) (#1) An unknown error occurred&#8221;.Here is my code:var app = new Facebook.FacebookApp(AuthKey); var parameters = new Dictionary&lt;string, object&gt;{{&#8220;message&#8221;,&#8221;test&#8221;},{&#8220;description&#8221;,&#8221;test2&#8243;}}; FacebookMediaObject media = new FacebookMediaObject {FileName = &#8220;1&#8221;,ContentType = &#8220;image\/jpeg&#8221; }; WriteableBitmap wb = new WriteableBitmap(0, 0).FromResource(&#8220;\/Images\/thumbnails\/<\/li>\n<\/ul>\n<p id=\"rop\"><small>Originally posted 2013-11-27 05:09:21. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Richard facebook-c#-sdk I have been successful in creating test users for my console-based application using: public dynamic CreateTestUser(string name) {return client.Post(APP_ID + &#8220;\/accounts\/test-users?installed=true&amp;name=&#8221; + name + &#8220;&amp;permissions=read_stream&#8221;); }However, now I&#8217;m trying to delete the users that I have created and have not had success.One method I&#8217;ve tried is the following:FacebookClient client = new FacebookClient(APP_ID, APP_SECRET); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1552","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1552","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1552"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1552\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}