2
উরিতে হোস্ট প্রতিস্থাপন করুন
.NET ব্যবহার করে কোনও উরির হোস্ট-অংশটি প্রতিস্থাপনের সর্বোত্তম উপায় কী? অর্থাৎ: string ReplaceHost(string original, string newHostName); //... string s = ReplaceHost("http://oldhostname/index.html", "newhostname"); Assert.AreEqual("http://newhostname/index.html", s); //... string s = ReplaceHost("http://user:pass@oldhostname/index.html", "newhostname"); Assert.AreEqual("http://user:pass@newhostname/index.html", s); //... string s = ReplaceHost("ftp://user:pass@oldhostname", "newhostname"); Assert.AreEqual("ftp://user:pass@newhostname", s); //etc. System.Uri তেমন কোনও সহায়ক বলে মনে হয় না।