How to returnt he Current Page using the API ?
Hi
I am a newbie to the SF API and was wondering how I get the current SF content page in code. Specifically, I want to :
1. Get the Current Page
2. Get its Category
3. Use that category to perform another query against our DB... (I am mapping products to the taxonomy, so that if you change the taxonomy for the page, this will change the products that are displayed.
Any ideas ?
Cheers
Mark
Hello Mark,
Thank you for contacting Telerik Support.
You can use the bellow code snippet to get the currently viewed page:
public
PageNode GetCurrentPage()
SiteMapNode currentNode = SiteMapBase.GetCurrentProvider().CurrentNode;
PageSiteNode node = (PageSiteNode)currentNode;
return
App.WorkWith().Pages().Where(p => p.UrlName == node.UrlName).Get().FirstOrDefault();