Using CurrentPage from Class file

Vote:
 
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
#12874
Mar 25, 2008 18:35
Vote:
 
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
#15024
Mar 25, 2008 18:46
* 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.