Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Owais Vaiyani 6 posts 80 karma points
    Aug 02, 2014 @ 02:12
    Owais Vaiyani
    0

    Unable to retreive ConfigurationSection

    Hello

    I am getting null Section when trying to retreive configuration section. I am trying to do this so I can retreive CallbackUrl from the Netbanx.config like so this.Section.CallbackUrl

    Here are my service and configs
    public class NetbanxPaymentService : AbstractPaymentMethodService, IPaymentWindow

    {

            private NetbanxMethodServiceConfigurationSection Section { get; set; }

    public NetbanxPaymentService(CommerceConfigurationProvider configProvider) {

    Section = configProvider.GetSection<NetbanxMethodServiceConfigurationSection>(); }

     

    Root Web.Config
    -------------------------

    <sectionGroup name="commerce" type="System.Configuration.ConfigurationSectionGroup">

    <section name="netbanxPaymentMethodService" type="NetbanxPayment.Library.NetbanxMethodServiceConfigurationSection, NetbanxPayment" requirePermission="false"/>

    and <commerce>

    <netbanxPaymentMethodService configSource="umbraco\ucommerce\configuration\payments\Netbanx.config"/>

    Custom.config
    --------------------

    <configuration>

      <components>

        <component id="DemoStoreWebApi" service="UCommerce.Web.Api.IContainsWebservices, UCommerce.Web.Api" type="UCommerce.RazorStore.Services.AssemblyTag, UCommerce.RazorStore" />

        <component id="NetbanxPaymentMethodService" service="NetbanxPayment.Library.NetbanxPaymentService, NetbanxPayment" type="NetbanxPayment.Library.NetbanxPaymentService, NetbanxPayment" />

      </components>

    </configuration>

    Payments\Netbanx.config
    --------------------------------------

    <?xml version="1.0"?>

    <netbanxPaymentMethodService 

     merchantId="merchant Id"

        privateKey="private key"

     callbackUrl="http:\\www.test.com"    

     

    />

    any help will be appreciated. 

  • Jesper Nielsen 141 posts 498 karma points
    Aug 11, 2014 @ 13:14
    Jesper Nielsen
    100

    Hello Owais,

    The call to GetSection<NetbanxMethodServiceConfigurationSection>();

    will as default look for a section named "netbanxMethodService". It removes ConfigurationSection and lowercases the first letter.

    If you need it to find a section with a different name, use the GetSection method that takes a string.

    GetSection<NetbanxMethodServiceConfigurationSection>("netbanxPaymentMethodService"); // Note the additional "Payment".

    Kind regards,
    Jesper

Please Sign in or register to post replies

Write your reply to:

Draft