Uri.EscapeDataString()
instead of Uri.EscapeUriString()
CS-S1009The Uri.EscapeUriString()
method converts a URI string into its escaped representation. However, this API is obsolete as it can corrupt URIs in some cases. The safer alternative is Uri.EscapeDataString()
.
var escaped = Uri.EscapeUriString(uri);
var escaped = Uri.EscapeDataString(uri);