How do I replace all the spaces with %20 in C#? January 29, 2023 by Tarik Another way of doing this is using Uri.EscapeUriString(stringToEscape).