I want to know that for make sure that the file that will be download from my script will have the extension I want.
The file will not be at URLs like:
h
Here is my solution:
if (Uri.TryCreate(url, UriKind.Absolute, out var uri)){ Console.WriteLine(Path.GetExtension(uri.LocalPath)); }
First, I verify that my url is a valid url, then I get the file extension from the local path.