Validate a given url against valid comma seperated list of domain names
Prince Manchanda
Ranch Hand
Joined: Jun 25, 2001
Posts: 45
posted
0
Hi,
When my application is invoked with a redirect url, I need to validate the redirect url against a predefined list of valid domains. For example the application can be invoked as follows:
An example of the comma separated list of valid domain names that I have
Now my application will validate the url in the goto request parameter against the predefined list(as mentioned above)
My question here is
what is the best way to validate the url against the comma separated list of domain names.
One option that I have is to token-ise the domain list and then see if the url contains the valid domain or not. This requires string parsing.
The other option of using URL or URI classes for this purpose doesn't work in case of wild cards.