I was doing something with redirecting and return urls and I notice something funky. I ran this line of code in visual studios immediate window.
Uri.EscapeUriString("/z?x=y&w="+Uri.EscapeUriString("/a?b=c&d=e"))
"/z?x=y&w=/a?b=c&d=e"
Ok this looks like the wrong escape. How on earth is my app suppose to know if d is part of the query string or part of the string meant for the url i want to redirect to later. So I tried UnescapeDataString and googled it just in case.
Uri.UnescapeDataString(Uri.EscapeDataString("a b+c"))
"a b+c"
It turns out I shouldnt use it becasue it doesnt decode ‘+’ into space like it should
Uri.UnescapeDataString("ab+c")
"ab+c"
If UnescapeDataString and EscapeUriString are both not right then how the heck am I suppose to escape uri’s?
You may want to try
HttpUtility.UrlEncodeandHttpUtility.UrlDecode