What I want to implement is a combining function that takes one absolute path/uri and one relative path/uri and returns the two combined. For instance, consider these two paths:
var root = "c:\src"; var images = "/images/logo.png" ; var combined = Combine (root, images); // Either 'c:/src/images/logo.png' or 'c:\src\images\logo.png' is acceptable I want to avoid manually manipulating/intercepting forward and backward slashes and I want to stick to .Net built-in functionalities. I tried Uri and Path.Combine but no luck. The biggest problem is that the images starts with a forwarding slash, still I guess there must be a way to tell .Net to treat it as relative to the absolute path.
没有评论:
发表评论