I have set up ASP.Net health monitoring in web.config:
<healthMonitoring enabled="true">
<providers>
<clear />
<add name="CriticalMailEventProvider" type="System.Web.Management.SimpleMailWebEventProvider"
from="[email protected]" to="[email protected]"
bodyHeader="Application Error!" bodyFooter="Please investigate ASAP."
subjectPrefix="ERROR: " buffer="true" bufferMode="Critical Notification"
maxEventLength="8192" maxMessagesPerNotification="1"
/>
</providers></healthMonitoring>
And I am attempting to read the configuration of this provider in code:
Dim HealthMonitoring As System.Web.Configuration.HealthMonitoringSection
Dim ToAddress As String
HealthMonitoring = CType(WebConfigurationManager.GetWebApplicationSection("system.web/healthMonitoring"), HealthMonitoringSection)
ToAddress = HealthMonitoring.Providers(0).ElementInformation.Properties("to").Value.ToString
[Note: not actual production code, hard-coded & condensed for brevity]
The problem: While the ElementInformation.Properties collection contains the keys as expected, the Value is "Nothing" and so are all other properties of "Properties("to")".
How can I access the settings of the Provider?