I am trying to add custom nodes to my web.config file and I am running into a few issues. It looks something like this:
VB Code:
<configuration> <configSections> <section name="MySection" type="MySectionHandler"/> </configSections> <MySection> <CustomNode>1</CustomNode> <CustomNode>2</CustomNode> <CustomNode>3</CustomNode> <CustomNode>4</CustomNode> </MySection> ... </configuration>
Then I have the code for mysectionhandler as follows:
VB Code:
Public Class MySectionHandler Implements IConfigurationSectionHandler Public Function Create(ByVal parent As Object, ByVal configContext As Object, ByVal section As System.Xml.XmlNode) As Object Implements System.Configuration.IConfigurationSectionHandler.Create Return "HELLO" End Function End Class
Finally, I have my code that trys to display the values:
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = ConfigurationSettings.GetConfig("MySection") End Sub
I am getting an error on the Configuration.GetConfig line. The error I am getting is:
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Exception creating section handler.
It and it highlights the <section name="MySection" type="MySectionHandler"/> line in the Web.Config file.
Anyone seen this before, or can anyone offer any suggestions?




Reply With Quote