Copied to clipboard

Flag this post as spam?

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


  • Peter Duncanson 430 posts 1360 karma points c-trib
    Mar 16, 2011 @ 13:19
    Peter Duncanson
    0

    Can you access node on AppStart?

    I have a node in Umbraco that I store sitewide settings in. We now have a need to get to these on app start. We have a class which extends AppBase to handle the onstart call but it is falling over when I try getting the node:

    var settings = new Node( 1234 ); // Silently fails with object reference error

    So some quick sanity checking, can I even access Node's on start up? Is there a better way of doing what I'm after? Quite liked having the settings in a nice easy UI so would like to keep it that way if I can.

    Cheers

    Pete

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Mar 16, 2011 @ 13:35
    Matt Brailsford
    1

    At a guess, maybe the internal XML cache hasn't been loaded yet. Have you tried working with Document which hits the database rather than the cache?

    var settings = new Document(1234);

    Matt

  • Peter Duncanson 430 posts 1360 karma points c-trib
    Mar 16, 2011 @ 14:45
    Peter Duncanson
    0

    That got it, cheer mate.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Mar 16, 2011 @ 14:46
    Matt Brailsford
    0

    Cool,

    Using Document obviously has a performance hit, but as long as you are doing it only once at app start, can't see it being a problem.

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft