Does System.IO.Path.GetFileName Work on Network Paths and URLs?

Comments 0

Share to social media

Yes it does, but it’s going to return everything after the last slash in the string.  This means if you have a query string on the end of a URL then you’ll get that back as well.  As long as it’s just a path to the file, then you should be good to go.

Load comments

About the author

Damon Armstrong

See Profile

Damon Armstrong is a consultant with SystemwarePS in Dallas, Texas. He is also a blogger and author of Pro ASP.NET 2.0 Website Programming and SharePoint 2013 Essentials for Developers. He specializes in the Microsoft stack with a focus on web technologies like MVC, ASP.NET, JavaScript, and SharePoint. When not staying up all night coding, he can be found watching a bunch of kids, studying Biblical topics, playing golf, or recovering from staying up all night coding.