Hi again,

Yesterday I had some fun trying to use Flex to call an upload.cfm page but as the CF page was behind a secured system(i.e. need to be logged in to call a page) the system was looking for the Flex app to login again. I only found this out by running Charles Web Debugging app which showed the request and response http data. I saw that response was source for a login page, strangely though the flex app told me the upload was called successfully and the file was uploaded successfully.
Also looking at the HTTP data I saw that the jsessionid wasn’t being passed in alongside the Flex request so I needed to pass the session variable into the Flex app from ColdFusion. The CF was determining that the session was over so it was looking for a login. After looking around a bit I saw that it wasn’t possible to just get the Session variable from the swf directly you have to request it from ColdFusion as it is stored server side(I think).
So I made a function in a CFC to get the session variable:

[code lang="xml"]






[/code]

I call this from the Flex app using a Flex WebService and then when I’m doing a URL request I pass the jsessionid alongside the request like so:

[code lang="actionscript"]
var uploadDestination:String = myModel.CFLocation + model.AssetModel.getInstance().UPLOAD_CFM_NAME + ';jsessionid=' + myModel.sessionID;
[/code]

The session id is stored alongside the model as a variable. This essentially calls ‘upload.cfm;jsessionid=xyz’

This fixed my problem and the app works fine now.

Categories: Archive Post, ColdFusion, Flex Tags:
  1. No comments yet.
  1. No trackbacks yet.