[RESOLVED] [2005] Best way to get FileName and DirectoryName of a URL?
Hi All,
I was messing with this yesterday and today morning to get the FileName and URL without the FileName. Apparently Path.GetFileName and Path.DirectoryName only works for Local paths and not for URLs.
I was wondering what would be the best way to extract these information so that from a URL like http://wmwiki.com/downloads/itsfv/it....9.1-setup.zip I can get
FileName: itsfv-4.0.9.1-setup.zip and DirectoryName: http://wmwiki.com/downloads/itsfv
Thanks,
McoreD
1 Attachment(s)
Re: [2005] Best way to get FileName and DirectoryName of a URL?
IO.Path will work with URLs but you'll have to adjust the result slightly.
Re: [2005] Best way to get FileName and DirectoryName of a URL?
Wow, it works mate.
VB Code:
MessageBox.Show(Path.GetDirectoryName(downloadUrl).Replace('\\', '/').Replace(":/", "://"));
For some reason it didn't work last night and had an error in Console saying URI arent supported but that may be due to some other unfinished code I had last night. It works great today.
Thanks! :)