I am converting a VB6 project to C#. In the VB6 project, we have manually created methods for url building. In C#, we have Uri, UriBuilder etc. libraries.
I need to find a way to build the url by removing the additional backward, forward slashes.
For example, if I use UriBuilder,
UriBuilder uriBuilder = new UriBuilder();
uriBuilder.Scheme = "https";
uriBuilder.Host = @"www.facebook.com/";
uriBuilder.Path = @"/asa/dsd\";
When I call uriBuilder.ToString()
, here I got the result as
https://www.facebook.com//asa/dsd/
From the output, UriBuilder is not removing the additional forward/ backward slashes in the host name.
Could anybody please let me know, is there a library in C# which we can use to build the url by removing the additional slashes?
Thank you.