4 Replies Latest reply on Apr 8, 2010 2:11 PM by matthew horn

    Problem sending data in a url

    SiHoop Level 1

      I'm using the following code to send data to a new webpage containing a swf.The problem is that the url in the browser shows the full url including the sensitive data that is being sent to the page. I read that POST is supposed to hide the data, but in my case it is not working properly.

       

      I also read somewhere that           

      sendToURL(urlRequest);

       

      would work, but it does not.

       

      Can anyone provide a solution?

      Thanks!

       

                  connectionPw="123"
                  var urlRequest:URLRequest = new URLRequest("http://..../Maze.html#connectionPw="+connectionPw)
                  urlRequest.method = URLRequestMethod.POST;
                  navigateToURL( urlRequest );

        • 1. Re: Problem sending data in a url
          matthew horn Level 3

          well, one thing I noticed is that instead of a pound sign ("#") you should be using a question mark ("?") to separate the URL from the query string parameters. you're also passing the connectionPw as a GET (as a paraters in the URL) rather than as  POST var. try changing the method to GET.

          • 2. Re: Problem sending data in a url
            SiHoop Level 1

            I believe I have to use the # mark here. I tried with the '?' but it would not work. Something to do with
            URL fragments: Here's what I've been following

             

            http://livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_5.html

             

            I couldn't follow the following from your reply: Would you please elaborate, thanks!

             

            "you're also passing the connectionPw as a GET (as a paraters in the URL) rather than as  POST var."

            • 3. Re: Problem sending data in a url
              matthew horn Level 3

              You don't want to use URL fragments. That's for deep linking. Stick to using query string params, which come after the ? in a URL, and are separated by ampersands.

               

              As for the second part, what I mean is change  URLRequestMethod.POST to  URLRequestMethod.GET.

              • 4. Re: Problem sending data in a url
                SiHoop Level 1

                The reason I used deep linking was that was the only way that I could access the variables that were being sent from the first file. It took me most of the day finding a solution that would work! Is there a better way to capture the variables when I link to a file?

                 

                Here's what works for me in the file I've connetced to (the critical line is:  userName=o.connectionPw;):

                 

                import mx.managers.BrowserManager;
                import mx.managers.IBrowserManager;
                import mx.utils.URLUtil;
                private var bm:IBrowserManager;      

                 

                public function init():void{
                    bm = BrowserManager.getInstance();               
                    bm.init("");
                // The following code will parse a URL that passes string parameters after the "#" sign; for example:
                    var o:Object = URLUtil.stringToObject(bm.fragment);               
                    userName=o.connectionPw;
                .........
                }