This content has been marked as final. Show 7 replies
Flex can't pull down the cookie, but the browser hosting the flex app can, does that make sense?
here's what I do (same environment, ASP.NET)
1. Log person in via standard .aspx page. I'm using FormsAuthentication.
2. After a successful login, their browser has the cookie with whatever you want to stuff in it.
3. Redirect to page with Flex app.
4. When flex app makes web service calls or whatever, the browser hosting the flex app is authenticated, because the browser already has the cookie.
I actually do a little web service call in the background once the user is logged in to grab additional information about the user. The great thing is, the user is already authenticated, so I don't have to have them log in again.
Hope that helps.
So what you're saying is that once a cookie has been created all of my remoting calls will include that cookie? If that's the case that's great. I could just make remoting calls and have each remoting call pull the Session information out of the cookie.
I'm not sure about remoting calls, but I decorate all of my Web Service methods with: <EnableSession(true)>
Then they can share the same session variables as the session created by the ASP.NET/aspx page.
Are you using WebOrb or something like that? I'd be surprised if it DID NOT have cookie support baked in.
Get it? Cookie. Baked. Sorry. Hope that helped.
Yeah I'm afraid I do get it. Currently I'm using Fluorine as my Remoting Gateway. I suspect it has the cookies baked in as well. I'm currently working on something that will prove that out. Once I complete the the proof of concept I'll test it out and post my results on the board.
Will wait for your result hunter. Thanks.
I have completed my proof of concept, and I'm very pleased to report that each remoting request does send the Cookie down with it. I am using Flash Remoting with Fluorine as my Gateway, but I suspect that the same remains true for all of the major Gateways. What this means is even though my Flex application my not be able to access cookies directly my server side remoting methods may access all of the cookie information. Furthermore I can provide access to all of the cookie data to my Flex application through Remoting calls to the server. I appreciate all of the help I have received on this issue. You guys have been instrumental in removing a tremendous road block for me.
I am working on a file uploader for our site, that will let users upload images of robots that they are wanting to sell. I wanted to let them upload more than one image, then when they submit the form we get a list of the images they uploaded. We also check to make sure there is not an image with the same name. If so we append -1, -2 etc... So to let the flex app know what the true url to the renamed image is I set session cookies with php. Everything worked great in IE. I tried it in firefox and nothing... after searching adobe, and google I came across this post. Here is my fix. When the program loads I check for a few cookies, they are used if the user has submited a contact form before, if so it used the cookies to fill in the required fields in the form. Well in the php I added this to the array of cookies...
$cookieArray = array("value1"=>$cookie1,"sid"=>session_id());
I then have an invisable text line in the flex app named sid, so in flex I put this in the code,
sid.text = cookieArray['sid'];
then when I call on the upload script I used this.
var endpoint:String = "pathToUploadScript.php?sid=" + sid.text;
Then on the upload script page i added this to the top, just under the session_start();
Now my uploader works great in Firefox, and IE.
I have found other solutions to this but this was far much easier and faster. Hope this can help someone that is using flex, php.