Get the current node at the begin of the request

Posted by Community Admin on 03-Aug-2018 16:56

Get the current node at the begin of the request

All Replies

Posted by Community Admin on 19-Oct-2011 00:00

Hello,

Is there any way to get the current page node for each request? I tried to use "Telerik.Sitefinity.Web.SiteMapBase.GetActualCurrentNode()" and it is crashing in the "Application_BeginRequest" event expecting a value in the context user, for the "Application_AuthenticateRequest" and "Application_EndRequest" events the returned value is null.

Is there any other method to get the current node/page associated with the current request in the Global.asax file in one of these events?

Thanks.

Posted by Community Admin on 19-Oct-2011 00:00

Try this:

var currentProvider = SitefinitySiteMap.GetCurrentProvider() as SiteMapBase;
var currentNode = currentProvider.FindSiteMapNode(httpContext.Request.RawUrl, false);
/* don't forget that requests for images, stylesheets, etc will go through here. 'currentNode' for those resources will be null. */

Posted by Community Admin on 24-Oct-2011 00:00

Hello,

You can also use SiteMapBase.GetCurrentNode() and SiteMapBase.GetActualCurrentNode(). The second method can be used when you are on the first child page of a group page. It will return the child page instead of the group page.


Best wishes,
Radoslav Georgiev
the Telerik team

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 Public Issue Tracking system and vote to affect the priority of the items

This thread is closed