Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!



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
but 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
and why does it always return null.

Aug 25, 2010 10:51

See the SDK page:

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).

Aug 25, 2010 11:06

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.


Aug 25, 2010 11:31

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.

Aug 25, 2010 11:53
* 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.