if u r suing .net 2.0 version then u can check ur file upload extension
by
using
string extension = Path.GetExtension(FileInput.PostedFile.FileName);
switch(extension.tolower())
{
case ".doc": // do something
case ".jpg": // do something
...............
}
.jpg has various applications associated with it, depending on the system.
You cannot hard-code it in the sources.
I am not sure if there is an API for this, but the info is in regitry, in
HKEY_CLASSES_ROOT.
Take .rtf for instance and go to HKEY_CLASSES_ROOT\.rtf:
=====================
[HKEY_CLASSES_ROOT\.rtf]
@="Word.RTF.8"
"Content Type"="application/msword"
[HKEY_CLASSES_ROOT\.rtf\OpenWithList\WordPad.exe]
@=""
[HKEY_CLASSES_ROOT\.rtf\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
[HKEY_CLASSES_ROOT\.rtf\ShellNew]
"Data"="{\\rtf1}"
=====================
Then you go to Word.RTF.8 and see the various shell commands:
HKEY_CLASSES_ROOT\Word.RTF.8\shell\Edit
HKEY_CLASSES_ROOT\Word.RTF.8\shell\New
HKEY_CLASSES_ROOT\Word.RTF.8\shell\Open
HKEY_CLASSES_ROOT\Word.RTF.8\shell\Print
HKEY_CLASSES_ROOT\Word.RTF.8\shell\Printto
=====================