Help Errors with ToolKit

Jun 12, 2007 at 2:28 PM


I am struggling to get Microsofts facebook api to work properly. I have followed the instructions for the simple desktop application however I am getting an IO Exception unhandled "Unable to read data from the transport connection: Attempted to read or write protected memory. This is often an indication that other memory is corrupt" when ever I do the FacebookService.Get Anything.

It does however work about 3% of the time.

Any help would be appreciated.

Jun 12, 2007 at 3:53 PM
Hmm. 2 questions.

Have you tried the DesktopSample? Does it show the same behavior?

Do you use a Proxy for you web connections? This is the only thing I can think of that might cause some problems. I haven't done much testing through proxies.
Jun 12, 2007 at 6:15 PM
Another quick question. Is there a way for a desktop application to not make the user log in every time if they click "Save my login info to avoid logging in to Facebook again to use this application"

I cant figure out how to do it.

Jun 12, 2007 at 6:35 PM

Basically, you need to store the userId and SessionKey after they login the first time. When they come back, if you already know their sessionKey and UserID. You just set those 2 properties. Login will be avoided.
Jun 12, 2007 at 6:51 PM
That is what I thought. I ran the application once and logged in with the box checked.

I checked the sessionexpires and it was set to false, so I copied the key and id and stopped the app. I then reran with the following code.

facebookService1.SessionKey = "f6cb281c0b1210549297c142-2359222";
facebookService1.UserId = "2359222";

Collection<Album> fAlbums = facebookService1.GetPhotoAlbums(); <-- Gives me the exception: Incorrect signature;

If I remove the UId of the end of the sessionkey I get the following exception: Session key invalid or no longer valid.
Jun 12, 2007 at 7:04 PM
Strange. I have tried this a few times before without problems. I will try to get a chance to try it out again later today and see if I can reproduce your issue.

The error you are getting sounds related to not having the correct secret for signing the request.

I will try it out and let you know...
Jun 12, 2007 at 11:12 PM
This behavior seems to have changed slightly since I last tried it.

The issue is that since you are a desktop application, your secret changes when the session is started. (FB issues a new one).

So, in order to get infinite sessions working. You can actually need to store the SessionKey, UserId and Secret associated with the user. And then set all 3 properties on the FacebookService before making calls. It is not allowing the parameters to be signed with your distributed secret, only with the generated secret for the infinite sessions.

I was able to reproduce your error exactly. And adding retrieval of the generated secret, and set of that property fixed the issue.

Let me know if this solves your questions.