ASP.NET获取文件名,后缀名

using System.IO; //引入命名空间

string path = "text.aspx";

string pathName = Path.GetFileName(path); //获取文件全名 text.aspx

string pathName1 = Paht.GetFileNameWithoutExtension(path); //获取文件名 text

string pathName2 = Path.GetExtension(path); //获取文件后缀名 aspx

FileInfo 类

FileInfo fi = new FileInfo("C:/abc.txt");

fi.Extension 值:.txt