How to bind IIS://localhost/MimeMap to something other than the default website
I need to get the MIME types for the "current" website my code is running under, not the list of global MIME types assigned to IIS in general. I have some MIME types locally as开发者_开发问答signed to just a specific website, types I only want on this site and not server wide across all websites.
DirectoryEntry Path = new DirectoryEntry("IIS://localhost/MimeMap");
using this above I get just those global IIS MIME types. I've tried:
DirectoryEntry Path = new DirectoryEntry("IIS://" + HttpContext.Current.Request.Url.Host + "/MimeMap");
with no success. I get the same list of global MIME types, and not the local ones I've assigned to the site running the code.
I was originally using a method that required me to reference Microsoft.Web.Administration from the WINDOWS\System32\inetsrv directory, but I'd rather not reference that if I don't have to.
Thanks.
精彩评论