From an ASP.Net C# application I need to access the ‘Title’ property value from multiple (100+) files residing on the local file system.
e.g. Right click a file on your file system and select ‘Properties’. In the ‘Summary’ tab there is a ‘Title’ property along with ‘Subject’, ‘Category’ etc. properties. I am after the value residing in the ‘Title’ property.
Whilst developing the web application and testing using Cassini, I was able to extract the ‘Title’ property value using Shell32.dll
Folder folder = _shell.NameSpace(Path.GetDirectoryName(path));
FolderItem item = folder.ParseName(Path.GetFileName(path));
folder.GetDetailsOf(item, (int)eDetailColumns.Title);
The above code doesn’t work when running within IIS. The ‘folder’ object doesn’t contain any items.
I have read that the ASP.Net worker process does not have a running instance of explorer – thus no Shell causing my Shell32 code not to function correctly.
Is there another way I can extract the ‘Title’ property value from within an ASP.Net application?
Thanks in advance.
I just tested the following code running in IIS7 and I’m able to access the Title of a word document I created and various other properties belonging to it: