Get PageNode ID in Web Api

Posted by Community Admin on 04-Aug-2018 03:12

Get PageNode ID in Web Api

All Replies

Posted by Community Admin on 14-Aug-2014 00:00

Hello all, 

I have some of problems when using web Api in Sitefinity 7.0. I can get the PageNode ID in APIController with the code below:

var currentNode = Telerik.Sitefinity.Web.SiteMapBase.GetActualCurrentNode();
                PageNode pageNode = null;
                if (currentNode != null)
                    var manager = PageManager.GetManager();
                    pageNode = manager.GetPageNode(currentNode.Id);

Thanks all for helps.

Posted by Community Admin on 20-Aug-2014 00:00

Hello David,

Can you please provide more details about your use case scenario and the exact functionality you would like to achieve. How do you access the web api controller. If you are trying to access the Get action of the api controller, for example<controller>, and withing this Get action you are trying to get the current page, Sitefinity will try to find a page which has url<controller>. Since there is not a page with this url the result will be null.

Sabrie Nedzhip

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items

This thread is closed