Flex reorders URL String Parameters

english mobile

So now I'm trying to capture the Flex things I've learned in the last couple of weeks with Flex, and most of them are just a big amorphous blur. One thing I do remember is that my ASP page broke when called from Flex. Turns out that Flex doesn't leave the request parameters in the order you put them in when sending to ASP, even when you hard code the full URL string. No I have no idea either why it would rearrange them, but there you have it.

You may be asking yourself why does it matter? Well, I had some pre-existing code that runs stored queries living in my Access database. The SQL for that looks something like "Exec [myQuery] 'param1', 'param2', 'param3'". The ASP code doesn't know anything about what order those parameters are supposed to be in and how many there are supposed to be. So the order needs to come from somewhere.

When I found this bug, I could well have assumed that any code calling the ASP page would use a specific naming convention, and indeed my existing logic does do that. However, I did not want to be tied to a naming convention forever when it should not be necessary. What I could assume is that the parameters would be put together automatically in a loop, since it makes sense to call this logic from a function (and indeed that is how it is called from within Authorware). That meant that the names would be auto-generated and in ascending order.

So, I wrote a function in ASP to reorder the URL parameters in ascending order by name.

0 comments: