When uploading a file, you will usually want to check that the extension is of the correct type:

if ((String.Compare(fileExt, ".pdf", true)) == 0) {...}

However, the above code will not work if the letters are in a different case.

This is a better way which ignores the case:

if ((fileExt.IndexOf("pdf", StringComparison.OrdinalIgnoreCase) == 0)) {...}

UPDATE

An even better way (counteracts input such as "pdf2", etc.)

if (string.Equals(fileExt, ".pdf", StringComparison.OrdinalIgnoreCase)) {...}