Are you parsing the URL of the currently executing request? How are you getting access to the URL? If this is the case, you can simply use the Request.QueryString method to gain access to each name/value pair in the query string. If on the other hand you are trying to parse a string that you constructed in your program, you will need to use VFP's string manipulation functions, such as substr.
The example you have below does not seem correct to me. In this particular example the ampersand (&) has been URLEncoded to "%26". This should not be the case. Ampersands should only be URLEncoded if they are part of the name or the value. In this case, it is used as a delimiter between 2 name/value pairs. Here's an example, illustrating correct encoding of ampersands:
In this example the query string will contain two query string variables:
- type: "sales"
- company_name: "barnes & noble"
Spaces can also be URL-encoded as "+" characters:
In both examples above you can see that one of the ampersands (the one separating the type and company_name query string variables) was not encoded, while the one in the company name was. If the ampersand in the name was not encoded, the receiving server would treat the second part of the name as a separate query string variable.
| FoxWeb Support Team |
Sent by Steven Gruner on 06/02/2011 01:59:18 PM:
I'm using a url like http://www.mysite.com/map.htm?db=la2do%26uid=MMNOP
So far I'm just using substr() to parse each parameter which works fine. But
I'm wondering two things:
1) Is there an easier way than having to substr() each parameter?
2) Why does the ampersand not parse correctly if it's not url encoded?