I'm currently using "page editing template" (i.e. PagePropertiesInsert.ascx) to run some custom code i.e. the plan is to add a feature where we can set custom properties per page.
In doing so i'm finding the current page via the following code:
Dim siteMapPanel As UI.SiteMapPanel = DirectCast(Me.Page.Controls(0).Controls(1).FindControl("ContentPlaceHolder1").FindControl("siteMap"), UI.SiteMapPanel)
However unfortunately finding the current page via this logic does not work when you choose a page to edit from anywhere other than the left hand navigation of sitefinity (e.g. if you click all pages, and edit a page from the grid view for example).
Can you please advice what i'm doing wrong here or if there is better way to find the current editing page of sf?