views:

48

answers:

2

hi,

How we can know type of file in asp.net ?

+1  A: 

If you want to get the extension of the file then you can use the FileInfo class.

Use the FileSystemInfo.Extension Property

rahul
Am creating the excel file using spread xml tags.. and use content-type as vmd.xml while getting it to the client side. But at this type file type is .xml by default(even though extention is .xls).So i need to know the type is .xml not .xlsCan i get the same using FileSystemInfo.Extension Property
anish
A: 

Are you looking like...

if (System.IO.Path.GetExtension("YourFileName.xls"))
    {

    }
Muhammad Akhtar