Below code shows how to get the file extension in .NET using C# or VB.net. We may need to check the file extension to validate type of file while uploading. System.IO.Path provide GetExtension() method and will return you the extension of the input file.
C# code sample
string extension = Path.GetExtension("c:\\myFile.jpg");
in Vb.NET code example
Dim extension As String = Path.GetExtension("c:\myFile.zip")