Path.Combine很方便,但是在.NET框架中有没有类似的URLs函数呢?
我正在寻找这样的语法:
Url.Combine("http://MyUrl.com/", "/Images/Image.jpg")
它将返回:
"http://MyUrl.com/Images/Image.jpg"
Path.Combine很方便,但是在.NET框架中有没有类似的URLs函数呢?
我正在寻找这样的语法:
Url.Combine("http://MyUrl.com/", "/Images/Image.jpg")
它将返回:
"http://MyUrl.com/Images/Image.jpg"
那里有is a Todd Menier's comment above,Flurl包括Url.Combine
.
更多详情:
网址.联合收割机基本上是一条路径.合并URL,确保一个
var url = Url.Combine(
"http://MyUrl.com/",
"/too/", "/many/", "/slashes/",
"too", "few?",
"x=1", "y=2"
// result: "http://www.MyUrl.com/too/many/slashes/too/few?x=1&y=2"
PM> Install-Package Flurl.Http
或者get the stand-alone URL builder个没有HTTP功能:
PM> Install-Package Flurl