By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,294 Members | 1,174 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,294 IT Pros & Developers. It's quick & easy.

Parse File Name From Web Address

P: n/a
Using VB.Net what is the best way to parse a file name from a web address?

For example:
http://www.website.com/downloads/video1.avi

I want to extract video1.avi from the above address.

Thanks In Advance,
Lou
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
Lou,
I normally use System.File.IO.Path, something like:

Dim path As String = "http://www.website.com/downloads/video1.avi"
Dim fileName As String = System.IO.Path.GetFileName(path)

Hope this helps
Jay

"Lou Civitella" <lo*@webersystems.com> wrote in message
news:eC**************@TK2MSFTNGP14.phx.gbl...
| Using VB.Net what is the best way to parse a file name from a web address?
|
| For example:
| http://www.website.com/downloads/video1.avi
|
| I want to extract video1.avi from the above address.
|
| Thanks In Advance,
| Lou
|
|
Nov 21 '05 #2

P: n/a
You could use a regex:
Public Dim MyRegex as Regex = New Regex( _
"[^/]+$", _
RegexOptions.RightToLeft _
)

"Lou Civitella" <lo*@webersystems.com> wrote in message
news:eC**************@TK2MSFTNGP14.phx.gbl...
Using VB.Net what is the best way to parse a file name from a web address?

For example:
http://www.website.com/downloads/video1.avi

I want to extract video1.avi from the above address.

Thanks In Advance,
Lou

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.