In .NET 4.0, whats the equivalent function to IO.Path.GetFileName
for urls?
You may stick to creating Uri object or if you care about performance use something similar to this one:
public class UriHelpers
{
public static string GetFileNameFromUrl(string url)
{
string lastSegment = url.Split('/').Last();
return lastSegment.Substring(0, lastSegment.IndexOf('?') < 0 ? lastSegment.Length : lastSegment.IndexOf('?'));
}
}