When a url containing a query params that has a URL containing query params like this:
https://example.com/login/login.ashx?redirect_url=https://example.com?test=11&test2=22&test3=33
How can I then get https://example.com?test=11&test2=22&test3=33from that Url?
I've tried this with no luck
redirectUrl = HttpUtility.ParseQueryString(HttpUtility.UrlEncode(context.Request.Url.Query)).Get("redirect_url");.
This results in:
https://example.com?test=11
and I want https://example.com?test=11&test2=22&test3=33
&test2=22&test3=33belongs to thelogin.ashxURL, not theredirect_urlvalue, because the&characters are not properly encoded to be part of theredirect_urlvalue. The login URL was constructed incorrectly, so garbage in, garbage out. The only way to get what you want is to fix how the login URL is constructed in the first place.$"{ResolveUrl("~/")}login/login.ashx?redirect_url={HttpUtility.UrlEncode(Request.Url.AbsoluteUri)}"