Family said:
Unless I'm missing something, Uri.EscapeUriString() would leave the
string "
http://domain.com/test.pdf" unchanged.
Then the documentation is wrong. It reads "By default, the
EscapeUriString method converts all characters, except RFC 2396
unreserved characters, to their hexadecimal representation".
In turn, RFC 2396 describes "unreserved characters" as "upper and lower
case letters, decimal digits, and a limited set of punctuation marks and
symbols". The "limited set of punctuation marks and symbols" are: "-",
"_", ".", "!", "~", "*", "'", "(", and ")".
Notably absent in that collection of punctuation marks and symbols are
the colon ":" and the forward slash "/".
I was relying on the documentation before. After your reply, I went
ahead and tested it, and sure enough the colon and forward slash are
also left unchanged (there are many other reserved characters also left
unchanged, as it happens...of a short sample of characters, I found only
"%" and "^" getting escaped).
The documentation claims that RFC 2396 behavior is the default, and is
only changed if the application configuration is modified so that
IriParsing is "true". However, in my test not only did I not set that
setting to "true", I tried explicitly setting it to false, and I still
see the method failing to escape those characters.
Fortunately, the alternative method that Arne suggests appears to work
just fine.
Time to go submit yet another bug report on the documentation...
Pete