I'm writing a web application that dynamically creates URL's based off of some input, to be consumed by a client at another time. For discussion sake these URL's can contain certain characters, like a forward slash (i.e. '/'), which should not be interpreted as part of the actual URL, but just as an argument. For example:
http://mycompany.com/PartOfUrl1/PartOfUrl2/ArgumentTo/Url/GoesHere
As you can see, the ArgumentTo/Url/GoesHere does indeed have forward slashes but these should be ignored or escaped.
This may be a bad example but the question in hand is more general and applies to other special characters.
So, if there are pieces of a URL that are just arguments and should not be used to resolve the actual web request, what's a good way of handling this?
Update:
Given some of the answers I realized that I failed to point out a few pieces that hopefully will help clarify.
I would like to keep this fairly language agnostic as it would be great if the client could just make a request. For example, if the client knew that it wanted to pass ArgumentTo/Url/GoesHere, it would be great if that could be encoded into a unique string in which the server could turn around and decode it to use.
Can we assume that similar functions like HttpUtility.HtmlEncode/HtmlDecode in the .NET Framework are available on other systems/platforms? The URL does not have to be pretty by any means so having real words in the path does not really matter.
Would something like a base64 encoding of the argument work?
It seems that base64 encoding/decoding is fairly readily available on any platform/language.