views:

731

answers:

2

Summary: The behavior detailed below seems to indicate that if your app at www.someplace.com sets/retrieves data via a SharedObject, there is some sort of .sol collision if the user hits your app at someplace.com, and then later at someplace.com?name=value.

Can anyone confirm or refute this?


I'm working on a Flex web app that presents the user with a login page. When the user has logged in, he/she is presented with a 'room' which is associated with a 'group'.

We store the last-visited room/group combination in a SharedObject - so when a given user logs in, they are taken into the most recent room in which they were active.

That works fine, but we also have an auto-login system which involves the user clicking on a link to the app url with a query string attached. There are two types of these links.

1) the query string includes username, groupId, and roomId

2) the query string includes only the username

Because we are working fast and have only a few developers, the auto-login system is built on the last-vist system. During the auto-login process, the url is inspected and if groupId and roomId values are found in the query string, the SharedObject is opened and the last-visit group/room id values are overwritten by the param values.

That works fine, also, when the app is hit with a query string of the second type (no groupId and roomId params), the app goes to the SharedObject to get the stored room and group id values, as it normally would. And here's the problem:

The values it comes back with are whatever the last room/group param values were, not whatever the last last-visit room/group values are.

And if the given user has never hit the app with query string that included group and room id values, the app gets null values from the SharedObject.

It took some digging around, but what it looks like is happening is that a second set of data is being stored/expected in the SharedObject if a query string is present in the URL.

Looking at the .sol file in a text editor I see more untranslated code, and additional group and room values, once I've hit the app with URLs that contain query strings.

I'm not finding anything on the web about this, but that may just be due to a lack of necessary search skills.

Has anyone else run into anything similar? Or do you know how to address this?

I've tried setting Security.exactSettings to false, already - was really hoping that was going to work.

A: 

One thing to remember: - They are shared - but with a delay. If you get a shared object and make a change to it, the changes will be written to the client .sol - after a delay.

Also, I have noticed that for some clients (especially Vista), accessing ShraedObjects early in the app state throws an exception. If you try again a bit later, it usually succeeds.

Brian
Thanks a lot for the response, Brian. The issue isn't with accessing the SharedObject, though, or with the timing of when it is accessed - data is being retrieved just fine. I guess I should rewrite my problem. The issue has to do with what appears to be a difference in how data is written and...
Ross Henderson
... retrieved from the .sol when there is a query string present in the URL.I'll try to rewrite and simplify. If I can figure out a way to include code without exploding the size of this post, I'll do that, too.
Ross Henderson
A: 

It sounds like youre correctly writing to the shared object during the login process, but not writing the room/group to the shared object correctly when a user changes rooms/groups while using the app.

Thats why the values would be null if they had never gotten to the app with the room/group params and why the values arent reflecting changes that occur after the login process.

Also to make sure the values get saved to disk after you write them you can call mySharedObject.flush().

greg
Thanks, Greg. The data is being correctly written as the user changes rooms and groups. The problem is specifically with what is happening when the .sol is accessed when the url has/does not have a query string.
Ross Henderson
but what would the url paramaters have to do with the shared object access. are you saving the exact url to the SO and is it choking on the string? There shouldnt be any correlation between whether or not the flash movie was created with flashvars and SO access. can you post some code where you think it may be going wrong?
greg
That's really the question, actually. No, not saving the url. It seems like there is some sort of handle associated with the .sol, based on the URL - thought I have no idea why. I'll try to post some code in the very near future.
Ross Henderson