Vulnerability in EPiServer.Forms
It is common for me to need to get the CurrentPage from a piece of code where it isn't available as a page property e.g. within a masterpage.
I initial tried EPiServer.DataFactory.Instance.CurrentPagebut this always returns null.
So have been using EPiServer.PageBase PB = HttpContext.Current.Handler as EPiServer.PageBase; EPiServer.Core.PageData aCurrentPage = PB.CurrentPage;And this seems to work okay.
My question is what's the intended use of EPiServer.DataFactory.Instance.CurrentPageand why does it always return null.
See the SDK page: http://sdk.episerver.com/library/cms6/html/P_EPiServer_DataFactory_CurrentPage.htm
I suppose its kept there as a general concept which can be used by other page sources than the standard DataFactory (I imagine some kind of sequential source which allows access to the most recent page, or something like that).
Nah, its simply so that the property is part of the interface IPageSource, so it has to be implemented even though it has no "meaning" for the DataFactory (as it has no concept of a "CurrentPage")
I would however seen that the implementation simply throwed an exception with a clear text describing why you shouldnt call it.
That's what I meant, my imaginary sequential source would be a different implementation of IPageSource where it HAS meaning, and a meaning specific to that page source.