In IIS 7.5 web.config we can set authorization for various paths/folders like so:
<location path="logs/elmah/elmah.axd">
<system.web>
<authorization>
<allow users="bob@example.com" />
<deny users="*" />
</authorization>
</system.web>
</location>
Is it possible to make this authorization conditional? eg only use this location if it is the live server, not the local or staging or beta or etc server?
I use this to indicate what the current server is:
<appSettings>
<clear />
<add key="DeploymentEnv" value="Debug" />
</appSettings>
And then web.config transforms to change DeploymentEnv to the correct value.
Having different Web.config files for different environments it’s probably the right way. Have a look at Web.config transformations.
This MSDN article shows how to configure a staging configuration.