Is it possible to have all path separators return ‘/’ on Windows? #104207
Replies: 2 comments 2 replies
-
Why not use the URI constructor? |
Beta Was this translation helpful? Give feedback.
1 reply
-
var rootUri = new Uri(@"c:\webroot\");
var fullUri = new Uri(@"c:\webroot\dir1\test.gif");
var relativeUri = rootUri.MakeRelativeUri(fullUri);
Console.WriteLine(relativeUri); // => dir1/test.gif |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
lbgitjp
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
FileSystemInfo‘s Properties such as 'FullPath' and 'FullName', on Windows platform, it will use '\' as the path separator, and on other platforms will use '/' as the separator. I need to convert these paths to URLs for web, so when i get FullName on windows, i don't want it return "c:\webroot\dir1\test.txt", i want it return "c:/webroot/dir1/test.txt", is it possible?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions