Copied to clipboard

Flag this post as spam?

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


  • Tom 713 posts 954 karma points
    Jan 23, 2014 @ 07:58
    Tom
    0

    Get Url For Node in an HttpModule where UmbracoContext.Current is null?

    Hi Guys,

    I'm in Context_BeginRequest and am trying to get a niceurl from a node. at this point in the stack UmbracoContext.Current is null..

     

    I'm just wondering what the right way to access this info would be?

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jan 23, 2014 @ 10:07
    Ismail Mayat
    0

    Tom,

    There is http://our.umbraco.org/forum/developers/api-questions/3993-Accessing-current-node-in-a-HTTPModule see last post that may work or there may be better way?

    Regards

    Ismail

  • Tom 713 posts 954 karma points
    Jan 23, 2014 @ 23:03
    Tom
    0

    Hi Ismail,

    Thanks for the reply! Just wondering if I wanted to get a node that's NOT the current node.. equivalent to doing something like

    new UmbracoHelper(UmbracoContext.Current).NiceUrlWithDomain(<some node id>)

     

    I know UmbracoContext.Current is null at this stage in the pipeline. and you can't use var generalErrorPage = umbraco.library.NiceUrlWithDomain(Settings.Instance.UriNodeError);

     

    because context is null.. any other thoughts? straight to the db?

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jan 24, 2014 @ 10:08
    Ismail Mayat
    0

    Tom,

    You could use application context although that will get you a document i think that may or may not have url property?

    Regards

    Ismail

Please Sign in or register to post replies

Write your reply to:

Draft