Get File Name from URL (C#/.NET)
To get the file name from a URL like http://www.thejackol.com/files/project.exe:
string URL = "http://www.thejackol.com/files/project.exe";
string FileName = URL.Substring(URL.LastIndexOf("/") + 1,
(URL.Length - URL.LastIndexOf("/") - 1));
FileName will now contain project.exe


Seeing as you’re not validating the end of the file name you can leave off the length param:
string FileName = URL.Substring(URL.LastIndexOf(”/”) + 1);
HTH
Tim
Or: string fileName = Path.GetFileName(url);
Uri uri = new Uri(url);
string fileName = uri.Segments[uri.Segments.Length-1];
Path.GetFileName(url); seems right thanks,