More in this section

Forums / Sitefinity SDK / SiteMap.CurrentNode.Url is null

SiteMap.CurrentNode.Url is null

2 posts, 1 answered
  1. Duneel
    Duneel avatar
    166 posts
    08 Dec 2010
    29 Apr 2011
    Link to this post

    The website I'm working on was upgraded to 4.1. Now I'm having some issues finding the current page URL. The way I have implemented my logic was using SiteMap.CurrentNode.Url But now in 4.1 current node is always null.

    I need an alternative solution to find the URL of the current page. I'm having this logic within a custom widget (.ascx).

  2. Richard Baugh
    Richard Baugh avatar
    201 posts
    22 Aug 2012
    29 Apr 2011
    Link to this post
    Try using SiteMapBase.GetCurrentUrl() instead of the SiteMap.CurrentUrl. Since SP1, I believe the SiteMap does not use the correct provider that Sitefinity uses. So you have to use the SiteMapBase class for pretty much everything you would normally use SiteMap for. If you use a SiteMapDataSource from ASP.NET, then you need to set the provider for it to SiteMapBase.GetCurrentProvider().

    Hope this helps.
2 posts, 1 answered