How to remove URI extra slash when I converted NSUrl to URI

291 Views Asked by At

When I am trying to convert NSUrl to URI added an extra slash in the URL below is the method

public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
{
Uri uri = new Uri(url.AbsoluteString);
ViewController.Auth?.OnPageLoading(uri);
return true;
}

Output: uri=msauth.com.xxxxx.xxxxxxxx://auth/?code=ae49c2974f4a5ce7becc6ccc95ef98ac8c93cd314aeda9b46254e6f0e6f80957&scope=TriggerApi%20offline_access&state=dshrscvaicthdifb

excepted result: uri=msauth.com.xxxxx.xxxxxxxx://auth?code=ae49c2974f4a5ce7becc6ccc95ef98ac8c93cd314aeda9b46254e6f0e6f80957&scope=TriggerApi%20offline_access&state=dshrscvaicthdifb

Has anyone else encountered this issue?

1

There are 1 best solutions below

1
SuryasriKamini-MT On

As you want to remove only the trailing slash, you can try using uri = uri.TrimEnd('/'); I have tested in my local environment, and was able to remove the slash using uri = uri.TrimEnd('/'); enter image description here