tags:

views:

199

answers:

2

Is there a way to gracefully check whether a page exists in EpiServer CMS 5 (given a pageId integer) without having to catch the PageNotFoundException thrown by

DataFactory.Instance.GetPage(pageReference)

(EpiServer will happily create a PageReference using a non existing pageId).

Surely I can check whether a page exists without throwing an exception or doing a massive loop?

-- Lee

+1  A: 

[EPiServer CMS 5 R2 SP2] No, not without bypassing the page cache and that is more expensive than catching the exception.

Fredrik Haglund
Cheers Frederik. I thought not.
Lee Englestone
A: 

There is a static method of PageReference which should help:

PageReference.IsNullOrEmpty(pageLink)
Phil Peace