There are two static methods in System.Uri: EscapeDataString and EscapeUriString. Use first to escape any string after '?' in uri and second one to escape any string before '?':
Symbol | EscapeUriString | EscapeDataString |
---|---|---|
a | a | a |
b | b | b |
c | c | c |
space | %20 | %20 |
? | ? | %3F |
! | ! | %21 |
@ | @ | %40 |
# | # | %23 |
$ | $ | %24 |
% | %25 | %25 |
^ | %5E | %5E |
& | & | %26 |
* | * | %2A |
( | ( | %28 |
) | ) | %29 |
/ | / | %2F |
\ | %5C | %5C |
+ | + | %2B |
_ | _ | _ |
- | - | - |
< | %3C | %3C |
> | %3E | %3E |
, | , | %2C |
. | . | . |
' | ' | %27 |
" | %22 | %22 |
` | %60 | %60 |
~ | ~ | ~ |
а | %D0%B0 | %D0%B0 |
б | %D0%B1 | %D0%B1 |
в | %D0%B2 | %D0%B2 |