title: Download a file in c# via url when file type and file name is unknown
body: <p>This is related to <a href="https://stackoverflow.com/questions/307688/how-to-download-a-file-from-a-url-in-c">How to download a file from a URL in C#?</a> but in my case the url dosen't have file name included in url. suppose a url www.test.com/files0 is a file and in the browser it gets downloaded as 123.mpg how can i save it on server with the same name and extention?</p>
  
  <p>Basically, I want to get filename and type before downloading the file from url and only download the file if it is an allowed extension.</p>