I have some code in a SharePoint page that is attempting to get the provider information for the currently used Web App and Zone.
This code finds the zone name correctly:
SPWebApplication app = SPContext.Current.Site.WebApplication;
SPAlternateUrl u = app.AlternateUrls[Request.Url];
SPUrlZone zone = u.UrlZone;
The zone comes back "Custom" or "Default", depending on which URL/Server is used.
Next, I try to get the IIS Settings for that zone using the code below:
SPIisSettings settings = app.IisSettings[zone];
I get an exception when testing the "Custom" site/URL (AAM). It seems that no matter what URL/Server I access the site from, app.IisSettings[] only contains a "key" for "Default".
What am I missing?
Shayne