It seems like the best solution is to replace all multisets with one slash in LocalPath. IIS does this even when passing the URL to ASP.net.
The following code will do the trick.
x = new Uri(string.Format("{0}://{1}:{2}{3}{4}", x.Scheme, x.Host, x.Port, Regex.Replace(x.LocalPath, @"(?<!\:)/{2,}", "/"), x.Query));
source
share