views:

16

answers:

1

I'm reading out the mime types from IIS's MimeMap using the command

_mimeTypes = new Dictionary<string, string>();
//load from iis store.

DirectoryEntry Path = new DirectoryEntry("IIS://localhost/MimeMap");
PropertyValueCollection PropValues = Path.Properties["MimeMap"];

IISOle.MimeMap MimeTypeObj;
foreach (var item in PropValues)
{
    // IISOle -> Add reference to Active DS IIS Namespace provider
    MimeTypeObj = (IISOle.MimeMap)item;
    _mimeTypes.Add(MimeTypeObj.Extension, MimeTypeObj.MimeType);
}

Do I need replace the localhost part when I deploy it to my live server? If not, why not and what are the implications of not doing so.

Cheers

A: 

It should not be an issue to leave the host as 'localhost'.

After all, you want to get the MimeMap of the machine your app is running on, correct?

A possible complication that I can forsee is that if you are using a third party as a host. They can do anything they want with host headers and it may be possible that localhost is not available for whatever reason.

But you should simply give it a shot and adjust if necessary.

Sky Sanders
Yes. I just wanted to check before I deploy it to live. It works perfectly locally and on our staging/testing environment.
Rob