View Full Version : Adding New MIME type

06-20-2005, 02:55 PM

I am pretty new to InstallShield and I have a question I'm hoping you can help me with. I have an InstallScript Installation for Windows Server 2003 with IIS 6 and I need to register a new MIME type. What is the best way to do this? Do I need to convert my project to a different kind? Will I be forced to use some sort of custom VB script? Any and all info is more than welcome. Thanks a lot!

10-18-2005, 04:48 PM
Was searching for solutions to add mime types, and had a hell of a time.

We ended up using ADSI to modify the settings

You'll have to expand upon this, but here's what we did in our InstallScript

NUMBER mimeCount;
OBJECT objIIS, objIIS_Root, objVirtDir;
VARIANT mimeTypes;

set objIIS = CoGetObject("IIS://localhost/W3SVC","");
if (IsObject(objIIS)) then
set objIIS_Root = objIIS.Create("IIsWebServer", "103");
objIIS_Root.ServerComment = "App";
objIIS_Root.ConnectionTimeout = 600;

set objVirtDir = objIIS_Root.Create("IIsWebVirtualDir", "root");
if (IsObject(objVirtDir)) then
objVirtDir.Path = "c:\\web";
objVirtDir.AccessRead = TRUE;
objVirtDir.AccessScript = TRUE;

mimeTypes = objVirtDir.MimeMap;
mimeCount = SizeOf(mimeTypes);
Resize(mimeTypes, mimeCount + 1);
mimeTypes(mimeCount) = CoCreateObject("MimeMap");
mimeTypes(mimeCount).Extension = ".ext";
mimeTypes(mimeCount).MimeType = "mimetype/xml";

objVirtDir.MimeMap = mimeTypes;
end if;
end if;

The problem I kept getting stuck at was what do define mimeTypes as i tried an object array I tried a variant array, but all it's supposed to be is a variant. I'm not sure why, but that's the important part.

You can translate this to VB6.0 very easily.

Please let me know about any solutions you came up with, as I'd be extremely interested to know how you tackled the problem (if you have)