[Solved] How can i format and add a string // in any place after a directory?


Adding addition / characters is reasonably easy if you are certain the URLs are consistent – you can use a mixture of a Uri object to conveniently section the URL for you, combined with the string Replace() method:

class Program
{
    static void Main(string[] args)
    {

        var myUri = new Uri("ftp://ftp.newsxpressmedia.com/Images/CB 967x330.jpg");

        var modifiedUri = new Uri(string.Format( "{0}//{1}"  
                                                , myUri.Scheme  
                                                , (myUri.Host + myUri.LocalPath).Replace("https://stackoverflow.com/", "//")
                                                ));

        Console.ReadKey();
    }
}

However…. I doubt this is the source of your particular problem because you shouldn’t need to double up the forward slashes like that. Are you using the correct protocol? Can you confirm the URL you are using?

5

solved How can i format and add a string // in any place after a directory?