Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
Hi Adam,
I just got back from vacation so I might have miss understod your question. But if not something like this would work no?
var currentPage = CurrentPage as SimplePage
if( currentPage !=null)
%YourMagicHere%
Hi Petter,
Not quite, but actually I can use the same approach and try cast to TemplatePage.
var page = System.Web.HttpContext.Current.Handler as EPiServer.PageBase;
if (page != null && page.CurrentPage != null)
{
// We are either on a CMS generated page or a static aspx page which inherits from SimplePage.
if(page is TemplatePage)
{
// A page generated by CMS.
}
}
Cheers,
Adam
I have an static ASPX file in my website which inherits from SimplePage.
By inheriting from SimplePage, when I peform ((System.Web.HttpContext.Current.Handler)EPiServer.PageBase).CurrentPage, I get a reference to the start page which is what I want.
I need to however determine whether the current page is a real CMS page or not.
Other than taking the current url and trying to map to an internal page, is there any other way of doing this?
Thanks,
Adam