4 Replies Latest reply on Dec 11, 2007 6:25 AM by mae@ccg

    Session Tracking

      Hello everybody,
      I am newbie Flex developer. I tried to make logging system that checks username and password. Then, I keep user and password in the variable. After refresh everything has gone. So, I have to store info in sessions, but how can I do that ? I could not find any sample code in the net. If there is, could you inform me?

      Thanks in advance.
        • 1. Re: Session Tracking
          Mike B Baker Level 1
          Refreshing the page will cause everything to be initialised. If you want the information to persist you should consider using shared objects (which are like cookies) or use some server side code. Where is the username and password currently validated ? Are you calling a webservice to make a database call to validate this data or are you doing it internally by hard coding it in your actionscript ?

          • 2. Re: Session Tracking
            GmotesX Level 1
            I use webservice which makes database call and get info to check username and password and also generate Session in my web servis.
            sth like..
            I call web service
            <mx:WebService id="service" wsdl=""/>
            However, when I refresh page, web service will be called again. Therefore my Session has gone. Is there any method to solve whether using actionscript or web service?
            Thanks in advance.

            • 3. Re: Session Tracking
              Mike B Baker Level 1
              Even though the browser page is refreshed, the session should still be available on the server side, so should be accessable by your webservice. Maybe you can call the webservice and check if the session exists and return the data to your Flex application.

              • 4. Re: Session Tracking
                mae@ccg Level 1
                You need to decorate your web service with the right attribute

                <WebMethod(EnableSession:=True)> _
                Public Function Login(UserID as String, Password as String)
                'your login logic here

                End Function

                This works great for me. Please note, the above is VB, it looks like you are doing C# - the syntax on the decoration might be a little different.