Copied to clipboard

Flag this post as spam?

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

  • Matthew Scerri 4 posts 45 karma points
    Mar 05, 2014 @ 12:26
    Matthew Scerri

    Getting Node from Url

    Good afternoon,

    I am currently in need of a way to get a page id from a Url. I have found plenty of old topics relating to this issue, but none that provided an answer that seemed to work for me.

    If I've got this Url: /sample/url/node/ the only way I could find to fetch the associated node's id would be to do something like:


    However, something tells me that I'm probably over complicating it.

    Any help would be very much appreciated!



  • Tommy Albinsson 121 posts 254 karma points
    Mar 22, 2014 @ 14:09
    Tommy Albinsson


    You can use umbraco.uQuery.

    Node node = uQuery.GetNodeByUrl("/home.aspx");
  • wtct 78 posts 100 karma points
    May 20, 2016 @ 11:17

    Look out when you want to use it in Umbraco 6.2.6. My website is stoping when I call this method.

  • Alex Skrypnyk 5740 posts 21796 karma points MVP 4x admin c-trib
    Jul 04, 2018 @ 17:17
    Alex Skrypnyk

    If you're using Umbraco 4.11 or later, there are a new set of APIs that allow you to retrieve strongly-typed content (as opposed to dynamic - which can be frustrating when trying to evaluate types when debugging).

    UmbracoContext.Current.ContentCache.GetByRoute(string url) should do what you want.
Please Sign in or register to post replies

Write your reply to: