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
It is weird, but it works:
string url = @"http://example.com/file.jpg";
string ext = System.IO.Path.GetExtension(url);
MessageBox.Show(this, ext);
but as crono remarked below, it will not work with parameters:
string url = @"http://example.com/file.jpg?par=x";
string ext = System.IO.Path.GetExtension(url);
MessageBox.Show(this, ext);
result: ".jpg?par=x"