I get from Sitecore a link as an ashx. I need to know how I can get extension of the real file that is in there. It could be an .jpg, .pdf, .mp3 etc. Based on that extension I have to show different options. How to get the real file extension of a Sitecore ashx?
In the web.config set a empty Media.RequestExtension <setting name="Media.RequestExtension" value=""/>
Setting its value to blank give media urls a relevant extension like .jpg see the Extension Field in the media item.
If you still want to use urls with .ashx you can look at the mime type it is in the "Content-Type" http header it contains somethings like "image/jpg"