Short question this time for a change…
Is there a way to iterate through the “location” elements in a web.config?
<configuration>
...
<location path="some/path">
<system.web>
<authorization users="*" />
</system.web>
</location>
<location path="some/other/path">
<system.web>
<authorization users="?" />
</system.web>
</location>
...
<configuration>
… and say have an output of something like:
<table>
<tr>
<td>some/path</td>
<td>authorization: *</td>
</tr>
<tr>
<td>some/other/path</td>
<td>authorization: ?</td>
</tr>
</table>
Cheers 🙂
By using the ConfigurationLocation class.
You can retrieve your web.config like this:
From there you can iterate through your locations: