Try our conversational search powered by Generative AI!

Using CurrentPage from Class file

In a class file, I need to use the CurrentPage pagedata object, but I can't find any way of doing so, except always sending a reference in the parameters of the method. Using "Global.EPDataFactory.CurrentPage" in a class file always returns null as I understand. Is there a way to get the currentPage object? /Björn
Dec 15, 2006 12:06
I don't know if this is the recommended solution, but this should work: EPiServer.Core.IPageSource page = System.Web.HttpContext.Current.Handler as EPiServer.Core.IPageSource; if (page != null) { EPiServer.Core.PageData pd = page.CurrentPage; if (pd != null) { // do stuff here } } Brgds, Niklas
Dec 15, 2006 12:38
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.