Search code examples
sitecorepipeline

Determining if a page is a static .aspx page or does not exist in the sitecore pipeline


I'm working in the Sitecore pipeline on a processor. I need to determine if a request being sent is for a static .aspx page that does not have a context item or if the page being requested does not exist.

This will happen right after the ItemResolver process fires so the database is set to master for both an .aspx running through the pipeline and a request for a page that doesn't exist.

I can't check if the Context.Item == null because the static page has no item associated with it and I'd like to keep it that way since the content on said page will not be changing.

Let me know if you have any ideas to differentiate between these!


Solution

  • You might be able to use Sitecore.Context.Page.FilePath. It will be set to your Layout on a Sitecore item (i.e. '/layouts/standard layout.aspx') while on a static page it'll be the path to your page.

    If your static pages are all in a different location from your Sitecore layouts it might be as easy as just matching part of the FilePath.