*Version: Tridion 2009 *
I have added a Custom Configuration section in Tridion.ContentManager.Config for storing some values to be used by the Custom Resolver that I'm writing.
I will use this value to detect whether the current publish transaction is executing against the live publication target or not.
However, when I attempt to retrieve the values from the config file, I get "Object reference not set to an instance of an object." error.
This is how the configuration looks like:
<configuration> <configSections> <!-- Other Config Section Declarations --> <section name="My.ConfigSection" type="System.Configuration.NameValueSectionHandler" /> </configSections> <My.ConfigSection> <add key="LivePublicationTargetId" value="tcm:0-10-65537" /> </My.ConfigSection> <!-- Other Config Sections--> </configuration>
This is how I try to retrieve it from the IResolver class: (Please note that this is working for regular ASP.net websites.)
string LivePubTargetID = ((NameValueCollection)ConfigurationManager. GetSection("My.ConfigSection")).Get("LivePublicationTargetId");
This is the piece that returns
null and causes the error:
Any ideas about how to overcome this issue?